1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // PR3990 4 namespace N { 5 struct Wibble { 6 }; 7 8 typedef Wibble foo; 9 10 int zeppelin; // expected-note{{declared here}} 11 } 12 using namespace N; 13 14 foo::bar x; // expected-error{{no type named 'bar' in 'N::Wibble'}} 15 16 void f() { 17 foo::bar = 4; // expected-error{{no member named 'bar' in 'N::Wibble'}} 18 } 19 20 int f(foo::bar); // expected-error{{no type named 'bar' in 'N::Wibble'}} 21 22 int f(doulbe); // expected-error{{did you mean 'double'?}} 23 24 int fun(zapotron); // expected-error{{unknown type name 'zapotron'}} 25 int var(zepelin); // expected-error{{did you mean 'zeppelin'?}} 26 27 template<typename T> 28 struct A { 29 typedef T type; 30 31 type f(); 32 33 type g(); 34 35 static int n; 36 static type m; 37 static int h(T::type, int); // expected-error{{missing 'typename'}} 38 static int h(T::type x, char); // expected-error{{missing 'typename'}} 39 }; 40 41 template<typename T> 42 A<T>::type g(T t) { return t; } // expected-error{{missing 'typename'}} 43 44 template<typename T> 45 A<T>::type A<T>::f() { return type(); } // expected-error{{missing 'typename'}} 46 47 template<typename T> 48 void f(T::type) { } // expected-error{{missing 'typename'}} 49 50 template<typename T> 51 void g(T::type x) { } // expected-error{{missing 'typename'}} 52 53 template<typename T> 54 void f(T::type, int) { } // expected-error{{missing 'typename'}} 55 56 template<typename T> 57 void f(T::type x, char) { } // expected-error{{missing 'typename'}} 58 59 template<typename T> 60 void f(int, T::type) { } // expected-error{{missing 'typename'}} 61 62 template<typename T> 63 void f(char, T::type x) { } // expected-error{{missing 'typename'}} 64 65 template<typename T> 66 void f(int, T::type, int) { } // expected-error{{missing 'typename'}} 67 68 template<typename T> 69 void f(int, T::type x, char) { } // expected-error{{missing 'typename'}} 70 71 int *p; 72 73 // FIXME: We should assume that 'undeclared' is a type, not a parameter name 74 // here, and produce an 'unknown type name' diagnostic instead. 75 int f1(undeclared, int); // expected-error{{requires a type specifier}} 76 77 int f2(undeclared, 0); // expected-error{{undeclared identifier}} 78 79 int f3(undeclared *p, int); // expected-error{{unknown type name 'undeclared'}} 80 81 int f4(undeclared *p, 0); // expected-error{{undeclared identifier}} 82 83 int *test(UnknownType *fool) { return 0; } // expected-error{{unknown type name 'UnknownType'}} 84 85 template<typename T> int A<T>::n(T::value); // ok 86 template<typename T> 87 A<T>::type // expected-error{{missing 'typename'}} 88 A<T>::m(T::value, 0); // ok 89 90 template<typename T> int A<T>::h(T::type, int) {} // expected-error{{missing 'typename'}} 91 template<typename T> int A<T>::h(T::type x, char) {} // expected-error{{missing 'typename'}} 92 93 template<typename T> int h(T::type, int); // expected-error{{missing 'typename'}} 94 template<typename T> int h(T::type x, char); // expected-error{{missing 'typename'}} 95 96 template<typename T> int junk1(T::junk); // expected-warning{{variable templates are a C++1y extension}} 97 template<typename T> int junk2(T::junk) throw(); // expected-error{{missing 'typename'}} 98 template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}} expected-warning{{C++11}} 99 template<typename T> int junk4(T::junk j); // expected-error{{missing 'typename'}} 100 101 // FIXME: We can tell this was intended to be a function because it does not 102 // have a dependent nested name specifier. 103 template<typename T> int i(T::type, int()); // expected-warning{{variable templates are a C++1y extension}} 104 105 // FIXME: We know which type specifier should have been specified here. Provide 106 // a fix-it to add 'typename A<T>::type' 107 template<typename T> 108 A<T>::g() { } // expected-error{{requires a type specifier}} 109