[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / vtable-instantiation.cpp
blob78f2b3ed1a2afabbba0528c6c92420fd5a6e4982
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 namespace PR8640 {
4 template<class T1> struct C1 {
5 virtual void c1() {
6 T1 t1 = 3; // expected-error {{cannot initialize a variable}}
8 };
10 template<class T2> struct C2 {
11 void c2() {
12 new C1<T2>(); // expected-note {{in instantiation of member function}}
16 void f() {
17 C2<int*> c2;
18 c2.c2(); // expected-note {{in instantiation of member function}}
22 namespace PR9325 {
23 template<typename T>
24 class Target
26 public:
27 virtual T Value() const
29 return 1; // expected-error{{cannot initialize return object of type 'int *' with an rvalue of type 'int'}}
33 template<typename T>
34 struct Provider
36 static Target<T> Instance;
39 template<typename T>
40 Target<T> Provider<T>::Instance; // expected-note{{in instantiation of}}
42 void f()
44 Target<int*>* traits = &Provider<int*>::Instance; // expected-note{{requested here}}
48 namespace PR10020 {
49 struct MG {
50 virtual void Accept(int) = 0;
53 template <typename Type>
54 struct GMG : MG {
55 void Accept(int i) {
56 static_cast<Type *>(0)->Accept(i); // expected-error{{member reference base}}
58 static GMG* Method() { return &singleton; } // expected-note{{in instantiation of}}
59 static GMG singleton;
62 template <typename Type>
63 GMG<Type> GMG<Type>::singleton; // expected-note{{requested here}}
65 void test(void) {
66 GMG<int>::Method(); // expected-note{{in instantiation of}}