[clang][lex] NFCI: Use DirectoryEntryRef in ModuleMap::inferFrameworkModule()
[llvm-project.git] / clang / test / SemaTemplate / instantiate-member-expr.cpp
blobabe7ec8f5445fa27b192224052670f3d3ba29990
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic
2 template<typename T>
3 struct S {
4 S() { }
5 };
7 template<typename T>
8 struct vector {
9 void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array with a negative size}}
12 class ExprEngine {
13 public:
14 typedef vector<S<void *> >CheckersOrdered;
15 CheckersOrdered Checkers;
17 template <typename CHECKER>
18 void registerCheck(CHECKER *check) {
19 Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<S<void *>>::push_back' requested here}}
23 class RetainReleaseChecker { };
25 void f(ExprEngine& Eng) {
26 Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'ExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
29 // PR 5838
30 namespace test1 {
31 template<typename T> struct A {
32 int a;
35 template<typename T> struct B : A<float>, A<T> {
36 void f() {
37 a = 0; // should not be ambiguous
40 template struct B<int>;
42 struct O {
43 int a;
44 template<typename T> struct B : A<T> {
45 void f() {
46 a = 0; // expected-error {{'test1::O::a' is not a member of class 'test1::O::B<int>'}}
50 template struct O::B<int>; // expected-note {{in instantiation}}
53 // PR7248
54 namespace test2 {
55 template <class T> struct A {
56 void foo() {
57 T::bar(); // expected-error {{type 'int' cannot}}
61 template <class T> class B {
62 void foo(A<T> a) {
63 a.test2::template A<T>::foo(); // expected-note {{in instantiation}}
67 template class B<int>;
70 namespace PR14124 {
71 template<typename T> struct S {
72 int value;
74 template<typename T> void f() { S<T>::value; } // expected-error {{invalid use of non-static data member 'value'}}
75 template void f<int>(); // expected-note {{in instantiation of}}
77 struct List { List *next; };
78 template<typename T, T *(T::*p) = &T::next> struct A {};
79 A<List> a; // ok
80 void operator&(struct Whatever);
81 template<typename T, T *(T::*p) = &T::next> struct B {};
82 B<List> b; // still ok