blob: 45503b38b38dae196532f4725bbdec39975c87d9 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
Anders Carlsson09025312009-08-29 05:16:22 +00002
3template<typename T> struct A {
Douglas Gregor9db7dbb2010-01-31 09:12:51 +00004 A() : a(1) { } // expected-error{{cannot initialize a member subobject of type 'void *' with an rvalue of type 'int'}}
Anders Carlsson09025312009-08-29 05:16:22 +00005
6 T a;
7};
8
9A<int> a0;
10A<void*> a1; // expected-note{{in instantiation of member function 'A<void *>::A' requested here}}
11
12template<typename T> struct B {
John McCalld6ca8da2010-04-10 07:37:23 +000013 B() : b(1), // expected-warning {{field 'b' will be initialized after field 'a'}}
14 a(2) { }
Anders Carlsson09025312009-08-29 05:16:22 +000015
16 int a;
17 int b;
18};
19
Anders Carlssonbcc12fd2010-04-02 06:26:44 +000020B<int> b0; // expected-note {{in instantiation of member function 'B<int>::B' requested here}}
Eli Friedmanc5573a82009-08-29 22:22:07 +000021
22template <class T> struct AA { AA(int); };
23template <class T> class BB : public AA<T> {
John McCall7002f4c2010-04-09 19:03:51 +000024public:
Eli Friedmanc5573a82009-08-29 22:22:07 +000025 BB() : AA<T>(1) {}
26};
27BB<int> x;