[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / member-class-11.cpp
blob20d6bce954f199efc0c1f7fc5b306e11090a402d
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s
3 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
5 struct rdar9677163 {
6 struct Y { ~Y(); };
7 struct Z { ~Z(); };
8 Y::~Y() { } // expected-error{{non-friend class member '~Y' cannot have a qualified name}}
9 ~Z(); // expected-error{{expected the class name after '~' to name the enclosing class}}
12 namespace GH56772 {
14 template<class T>
15 struct A {
16 ~A<T>();
18 #if __cplusplus >= 202002L
19 // FIXME: This isn't valid in C++20 and later.
20 #endif
22 struct B;
24 template<class T>
25 struct C {
26 ~B(); // expected-error {{expected the class name after '~' to name the enclosing class}}
29 template <typename T>
30 struct D {
31 friend T::S::~S();
32 private:
33 static constexpr int secret = 42;
36 template <typename T>
37 struct E {
38 friend T::S::~V();
41 struct BadInstantiation {
42 struct S {
43 struct V {};
47 struct GoodInstantiation {
48 struct V {
49 ~V();
51 using S = V;
54 // FIXME: We should diagnose this while instantiating.
55 E<BadInstantiation> x;
56 E<GoodInstantiation> y;
58 struct Q {
59 struct S { ~S(); };
62 Q::S::~S() {
63 void foo(int);
64 foo(D<Q>::secret);
67 struct X {
68 ~X();
70 struct Y;
72 struct Z1 {
73 friend X::~Y(); // expected-error {{expected the class name after '~' to name the enclosing class}}
76 template <class T>
77 struct Z2 {
78 friend X::~Y(); // expected-error {{expected the class name after '~' to name the enclosing class}}