namespace std {
struct type_info;
using size_t = decltype(sizeof(0)); template<typename T> struct initializer_list {
initializer_list(T*, size_t);
T *p;
size_t n;
T *begin();
T *end();
};
}
template<typename ...T> class Variadic1 {};
template<template<typename> class ...T> class Variadic2 {};
template<int ...I> class Variadic3 {};
alignas(8) int with_alignas; int with_attribute [[ ]];
void Literals() {
(void)u8"str"; (void)u"str"; (void)U"str"; (void)u'x'; (void)U'x';
(void)u8R"X(str)X"; (void)uR"X(str)X"; (void)UR"X(str)X"; (void)R"X(str)X"; (void)LR"X(str)X"; }
template<typename T> struct S {};
namespace TemplateParsing {
S<::S<void> > s; S< ::S<void>> t; }
void Lambda() {
[]{}(); [](){}(); }
struct Ctor {
Ctor(int, char);
Ctor(double, long);
};
struct InitListCtor {
InitListCtor(std::initializer_list<bool>);
};
int InitList(int i = {}) { (void)new int {}; (void)int{}; int x { 0 }; S<int> s = {}; s = {}; std::initializer_list<int> xs = { 1, 2, 3 }; auto ys = { 1, 2, 3 }; Ctor c1 = { 1, 2 }; Ctor c2 = { 3.0, 4l }; InitListCtor ilc = { true, false }; const int &r = { 0 }; struct { int a; const int &r; } rr = { 0, {0} }; return { 0 }; }
struct DelayedDefaultArgumentParseInitList {
void f(int i = {1}) { }
};
int operator"" _hello(const char *);
enum EnumFixed : int { };
enum class EnumScoped { };
void Deleted() = delete; struct Defaulted {
Defaulted() = default; };
int &&RvalueReference = 0; struct RefQualifier {
void f() &; };
auto f() -> int; #ifdef CXX14COMPAT
auto ff() { return 5; } #endif
void RangeFor() {
int xs[] = {1, 2, 3};
for (int &a : xs) { }
for (auto &b : {1, 2, 3}) {
}
struct Agg { int a, b; } const &agg = { 1, 2 }; }
struct InClassInit {
int n = 0; };
struct OverrideControlBase {
virtual void f();
virtual void g();
};
struct OverrideControl final : OverrideControlBase { virtual void f() override; virtual void g() final; };
using AliasDecl = int; template<typename T> using AliasTemplate = T;
inline namespace InlineNS { }
auto auto_deduction = 0; int *p = new auto(0);
const int align_of = alignof(int); char16_t c16 = 0; char32_t c32 = 0; constexpr int const_expr = 0; decltype(const_expr) decl_type = 0; __decltype(const_expr) decl_type2 = 0; void no_except() noexcept; bool no_except_expr = noexcept(1 + 1); void *null = nullptr; static_assert(true, "!");
struct InhCtorBase {
InhCtorBase(int);
};
struct InhCtorDerived : InhCtorBase {
using InhCtorBase::InhCtorBase; };
struct FriendMember {
static void MemberFn();
friend void FriendMember::MemberFn(); };
struct DelegCtor {
DelegCtor(int) : DelegCtor() {} DelegCtor();
};
template<int n = 0> void DefaultFuncTemplateArg();
template<typename T> int TemplateFn(T) { return 0; }
void LocalTemplateArg() {
struct S {};
TemplateFn(S()); }
struct {} obj_of_unnamed_type; int UnnamedTemplateArg = TemplateFn(obj_of_unnamed_type);
#ifndef CXX17COMPAT
namespace RedundantParensInAddressTemplateParam {
int n;
template<int*p> struct S {};
S<(&n)> s; S<(((&n)))> t; }
#endif
namespace TemplateSpecOutOfScopeNs {
template<typename T> struct S {};
}
template<> struct TemplateSpecOutOfScopeNs::S<char> {};
struct Typename {
template<typename T> struct Inner {};
};
typename ::Typename TypenameOutsideTemplate(); Typename::template Inner<int> TemplateOutsideTemplate();
struct TrivialButNonPOD {
int f(int);
private:
int k;
};
void Ellipsis(int n, ...);
void TrivialButNonPODThroughEllipsis() {
Ellipsis(1, TrivialButNonPOD()); }
struct HasExplicitConversion {
explicit operator bool(); };
struct Struct {};
enum Enum { enum_val = 0 };
struct BadFriends {
friend enum ::Enum; friend int; friend Struct; };
int n = {};
class PrivateMember {
struct ImPrivate {};
};
template<typename T> typename T::ImPrivate SFINAEAccessControl(T t) { return typename T::ImPrivate();
}
int SFINAEAccessControl(...) { return 0; }
int CheckSFINAEAccessControl = SFINAEAccessControl(PrivateMember());
namespace UnionOrAnonStructMembers {
struct NonTrivCtor {
NonTrivCtor(); };
struct NonTrivCopy {
NonTrivCopy(const NonTrivCopy&); };
struct NonTrivDtor {
~NonTrivDtor(); };
union BadUnion {
NonTrivCtor ntc; NonTrivCopy ntcp; NonTrivDtor ntd; };
struct Wrap {
struct {
NonTrivCtor ntc; NonTrivCopy ntcp; NonTrivDtor ntd; };
};
union WithStaticDataMember {
static constexpr double d = 0.0; static const int n = 0; static int k; };
}
int EnumNNS = Enum::enum_val; template<typename T> void EnumNNSFn() {
int k = T::enum_val; };
template void EnumNNSFn<Enum>();
void JumpDiagnostics(int n) {
goto DirectJump; TrivialButNonPOD tnp1;
DirectJump:
void *Table[] = {&&DirectJump, &&Later};
goto *Table[n];
TrivialButNonPOD tnp2; Later: switch (n) {
TrivialButNonPOD tnp3; default: return;
}
}
namespace UnevaluatedMemberAccess {
struct S {
int n;
int f() { return sizeof(S::n); } };
int k = sizeof(S::n); const std::type_info &ti = typeid(S::n); }
namespace LiteralUCNs {
char c1 = '\u001e'; wchar_t c2 = L'\u0041'; const char *s1 = "foo\u0031"; const wchar_t *s2 = L"bar\u0085"; }
#ifndef CXX17COMPAT
namespace NonTypeTemplateArgs {
template<typename T, T v> struct S {};
const int k = 5; static void f() {} S<const int&, k> s1; S<void(&)(), f> s2; }
namespace NullPointerTemplateArg {
struct A {};
template<int*> struct X {};
template<int A::*> struct Y {};
X<(int*)0> x; Y<(int A::*)0> y; }
#endif
namespace PR13480 {
struct basic_iterator {
basic_iterator(const basic_iterator &it) {} basic_iterator(basic_iterator &it) {}
};
union test {
basic_iterator it; };
}
namespace AssignOpUnion {
struct a {
void operator=(const a &it) {} void operator=(a &it) {}
};
struct b {
void operator=(const b &it) {} };
union test1 {
a x; b y; };
}
namespace rdar11736429 {
struct X { X(const X&) = delete; };
union S {
X x; };
}
template<typename T> T var = T(10);
#ifdef CXX14COMPAT
#else
#endif
template<typename T> T* var<T*> = new T();
template<> int var<int> = 10;
template char var<char>;
float fvar = var<float>;
class A {
template<typename T> static T var = T(10);
#ifdef CXX14COMPAT
#else
#endif
template<typename T> static T* var<T*> = new T();
};
struct B { template<typename T> static T v; };
#ifdef CXX14COMPAT
#else
#endif
template<typename T> T B::v = T();
#ifdef CXX14COMPAT
#else
#endif
template<typename T> T* B::v<T*> = new T();
template<> int B::v<int> = 10;
template char B::v<char>;
float fsvar = B::v<float>;
#ifdef CXX14COMPAT
int digit_seps = 123'456; #endif
#ifdef CXX17COMPAT
template<class T> struct CTAD {};
void ctad_test() {
CTAD<int> s;
CTAD t = s; }
#endif