Debian Codegraph @

clang/test/SemaTemplate/temp.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3
4 namespace test0 {
5 // p3
6 template<typename T> int foo(T), bar(T, T); // expected-error{{single entity}}
7 }
8
9 // PR7252
10 namespace test1 {
11 namespace A { template<typename T> struct Base { typedef T t; }; } // expected-note {{member type 'test1::A::Base<char>' found}} expected-note 2{{declared here}}
12 namespace B { template<typename T> struct Base { typedef T t; }; } // expected-note {{member type 'test1::B::Base<int>' found}}
13
14 template<typename T> struct Derived : A::Base<char>, B::Base<int> {
15 typename Derived::Base<float>::t x; // expected-error {{found in multiple base classes of different types}}
16 };
17
18 class X : A::Base<int> {}; // expected-note 2{{private}}
19 class Y : A::Base<float> {};
20 struct Z : A::Base<double> {};
21 struct Use1 : X, Y {
22 Base<double> b1; // expected-error {{private}}
23 Use1::Base<double> b2; // expected-error {{private}}
24 };
25 struct Use2 : Z, Y {
26 Base<double> b1;
27 Use2::Base<double> b2;
28 };
29 struct Use3 : X, Z {
30 Base<double> b1;
31 Use3::Base<double> b2;
32 };
33 }
34
35 namespace test2 {
36 struct A { static int x; }; // expected-note 4{{member}}
37 struct B { template<typename T> static T x(); }; // expected-note 4{{member}}
38 struct C { template<typename T> struct x {}; }; // expected-note 3{{member}}
39 struct D { template<typename T> static T x(); }; // expected-note {{member}}
40
41 template<typename ...T> struct X : T... {};
42
43 void f() {
44 X<A, B>::x<int>(); // expected-error {{found in multiple base classes of different types}}
45 X<A, C>::x<int>(); // expected-error {{found in multiple base classes of different types}}
46 X<B, C>::x<int>(); // expected-error {{found in multiple base classes of different types}}
47 X<A, B, C>::x<int>(); // expected-error {{found in multiple base classes of different types}}
48 X<A, B, D>::x<int>(); // expected-error {{found in multiple base classes of different types}}
49 }
50 }