brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 9ce8b69 Raw
121 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5// PR39906namespace N {7  struct Wibble {8  };9 10  typedef Wibble foo;11 12  int zeppelin; // expected-note{{declared here}}13}14using namespace N;15 16foo::bar x; // expected-error{{no type named 'bar' in 'N::Wibble'}}17 18void f() {19  foo::bar  = 4; // expected-error{{no member named 'bar' in 'N::Wibble'}}20}21 22int f(foo::bar); // expected-error{{no type named 'bar' in 'N::Wibble'}}23 24int f(doulbe); // expected-error{{did you mean 'double'?}}25 26int fun(zapotron); // expected-error{{unknown type name 'zapotron'}}27int var(zepelin); // expected-error{{did you mean 'zeppelin'?}}28 29template<typename T>30struct A {31  typedef T type;32 33  type f();34 35  type g();36 37  static int n;38  static type m;39  static int h(T::type, int); // expected-warning{{missing 'typename'}}40  static int h(T::type x, char); // expected-warning{{missing 'typename'}}41};42 43template<typename T>44A<T>::type g(T t) { return t; } // expected-warning{{missing 'typename'}}45 46template<typename T>47A<T>::type A<T>::f() { return type(); } // expected-warning{{missing 'typename'}}48 49template<typename T>50void f(T::type) { } // expected-error{{missing 'typename'}}51 52template<typename T>53void g(T::type x) { } // expected-error{{missing 'typename'}}54 55template<typename T>56void f(T::type, int) { } // expected-error{{missing 'typename'}}57 58template<typename T>59void f(T::type x, char) { } // expected-error{{missing 'typename'}}60 61template<typename T>62void f(int, T::type) { } // expected-error{{missing 'typename'}}63 64template<typename T>65void f(char, T::type x) { } // expected-error{{missing 'typename'}}66 67template<typename T>68void f(int, T::type, int) { } // expected-error{{missing 'typename'}}69 70template<typename T>71void f(int, T::type x, char) { } // expected-error{{missing 'typename'}}72 73int *p;74 75int f1(undeclared, int); // expected-error{{unknown type name 'undeclared'}}76 77int f2(undeclared, 0); // expected-error{{undeclared identifier}}78 79int f3(undeclared *p, int); // expected-error{{unknown type name 'undeclared'}}80 81int f4(undeclared *p, 0); // expected-error{{undeclared identifier}}82 83int *test(UnknownType *fool) { return 0; } // expected-error{{unknown type name 'UnknownType'}}84 85template<typename T> int A<T>::n(T::value); // ok86template<typename T>87A<T>::type // expected-warning {{missing 'typename'}}88A<T>::m(T::value, 0); // ok89 90template<typename T> int A<T>::h(T::type, int) {} // expected-warning{{missing 'typename'}}91template<typename T> int A<T>::h(T::type x, char) {} // expected-warning{{missing 'typename'}}92 93template<typename T> int h(T::type, int); // expected-error{{missing 'typename'}}94template<typename T> int h(T::type x, char); // expected-error{{missing 'typename'}}95 96template<typename T> int junk1(T::junk);97#if __cplusplus <= 201103L98// expected-warning@-2 {{variable templates are a C++14 extension}}99#endif100template<typename T> int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}101template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}102#if __cplusplus <= 199711L103//expected-warning@-2 {{deleted function definitions are a C++11 extension}}104#endif105 106template<typename T> int junk4(T::junk j); // expected-error{{missing 'typename'}}107 108// FIXME: We can tell this was intended to be a function because it does not109//        have a dependent nested name specifier.110template<typename T> int i(T::type, int());111#if __cplusplus <= 201103L112// expected-warning@-2 {{variable templates are a C++14 extension}}113#endif114 115 116// FIXME: We know which type specifier should have been specified here. Provide117//        a fix-it to add 'typename A<T>::type'118template<typename T>119A<T>::g() { } // expected-error{{expected unqualified-id}}120// expected-warning@-1{{missing 'typename'}}121