1 // RUN: %clang_cc1 -fsyntax-only -verify -fincremental-extensions -std=c++20 %s
2 // RUN: %clang_cc1 -fsyntax-only -DMS -fms-extensions -verify -fincremental-extensions -std=c++20 %s
4 extern "C" int printf(const char*,...);
6 // Decls which are hard to disambiguate
9 namespace ns1
{ template<typename T
> void tmplt(T
&) {}}
10 int arg_tmplt
= 12; ns1::tmplt(arg_tmplt
);
12 namespace ns2
{ template <typename T
> struct S
{}; }
13 namespace ns3
{ struct A
{ public: using S
= int; }; }
14 namespace ns3
{ A::S
f(A::S a
); }
16 // ParseStatementOrDeclaration returns multiple statements.
19 __if_exists(::g_bFlag
) {
20 printf("Entering __if_exists\n");
21 printf("g_bFlag = %d\n", g_bFlag
);
26 struct S1
{ operator int(); };
27 S1::operator int() { return 0; }
35 struct Dtor1
{~Dtor1();};
36 Dtor1::~Dtor1() { printf("Dtor1\n"); }
39 struct Dtor2
{ ~Dtor2(); };
40 ::Dtor2::~Dtor2() { printf("Dtor2\n"); }
43 struct ANestedDtor
{ struct A1
{ struct A2
{ ~A2(); }; }; };
44 ANestedDtor::A1::A2::~A2() { printf("Dtor A::A1::A2::~A2\n"); }
48 // Private typedefs / using declarations
49 class PrivateUsingMember
{ using T
= int; T
f(); };
50 PrivateUsingMember::T
PrivateUsingMember::f() { return 0; }
52 class PrivateUsingVar
{ using T
= int; static T i
; };
53 PrivateUsingVar::T
PrivateUsingVar::i
= 42;
55 // The same with namespaces
56 namespace PrivateUsingNamespace
{ class Member
{ using T
= int; T
f(); }; }
57 PrivateUsingNamespace::Member::T
PrivateUsingNamespace::Member::f() { return 0; }
59 namespace PrivateUsingNamespace
{ class Var
{ using T
= int; static T i
; }; }
60 PrivateUsingNamespace::Var::T
PrivateUsingNamespace::Var::i
= 42;
62 // The same with friend declarations
63 class PrivateUsingFriendMember
;
64 class PrivateUsingFriendVar
;
65 class PrivateUsingFriend
{ friend class PrivateUsingFriendMember
; friend class PrivateUsingFriendVar
; using T
= int; };
66 class PrivateUsingFriendMember
{ PrivateUsingFriend::T
f(); };
67 PrivateUsingFriend::T
PrivateUsingFriendMember::f() { return 0; }
69 class PrivateUsingFriendVar
{ static PrivateUsingFriend::T i
; };
70 PrivateUsingFriend::T
PrivateUsingFriendVar::i
= 42;
72 // The following should still diagnose (inspired by PR13642)
73 // FIXME: Should not be diagnosed twice!
74 class PR13642
{ class Inner
{ public: static int i
; }; };
75 // expected-note@-1 2 {{implicitly declared private here}}
76 PR13642::Inner::i
= 5;
77 // expected-error@-1 2 {{'Inner' is a private member of 'PR13642'}}
80 template<typename T
> struct A
{ A(); A(T
); };
86 namespace N
{ struct S
{ S(); }; }
87 N::S::S() { printf("N::S::S()\n"); }
90 namespace Ns
{namespace Ns
{ void Ns(); void Fs();}}
91 void Ns::Ns::Ns() { printf("void Ns::Ns::Ns()\n"); }
97 struct Attrs1
{ Attrs1(); };
98 Attrs1::Attrs1() __attribute((pure
)) = default;
100 struct Attrs2
{ Attrs2(); };
101 __attribute((pure
)) Attrs2::Attrs2() = default;