1 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
15 A:: ; // expected-error {{expected unqualified-id}}
16 // FIXME: redundant errors
17 ::A::ax::undef ex3; // expected-error {{no member named}} expected-error {{unknown type name}}
18 A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name}}
20 int A::C::Ag1() { return 0; }
22 static int A::C::Ag2() { return 0; } // expected-error{{'static' can}}
27 static int A::C::cx2 = 17; // expected-error{{'static' can}}
30 void m(); // expected-note{{member declaration nearly matches}}
32 void f(const int& parm); // expected-note{{member declaration nearly matches}}
33 void f(int) const; // expected-note{{member declaration nearly matches}}
39 void C2::m() const { } // expected-error{{out-of-line definition of 'm' does not match any declaration in 'C2'}}
41 void C2::f(int) { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'C2'}}
48 void ::A::Af() {} // expected-error {{definition or redeclaration of 'Af' not in a namespace enclosing 'A'}}
52 void A::Af(); // expected-error {{definition or redeclaration of 'Af' not allowed inside a function}}
56 A:: ; // expected-error {{expected unqualified-id}}
57 A::C::undef = 0; // expected-error {{no member named 'undef'}}
59 int x = ::A::ax = A::C::cx;
61 x = sizeof(::A::C::cx);
66 struct S : public A::C {};
67 struct A::undef; // expected-error {{'undef' does not name a tag member in the specified scope}}
86 N::x = 0; // expected-error {{use of undeclared identifier 'N'}}
88 N::x = 0; // expected-error {{expected a class or namespace}}
90 { typedef int A; A::ax = 0; } // expected-error{{expected a class or namespace}}
91 { typedef A::C A; A::ax = 0; } // expected-error {{no member named 'ax'}}
92 { typedef A::C A; A::cx = 0; }
95 // make sure the following doesn't hit any asserts
96 void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \
97 expected-error {{variable has incomplete type 'void'}}
99 typedef void C2::f5(int); // expected-error{{typedef declarator cannot be qualified}}
101 void f6(int A2::RC::x); // expected-error{{parameter declarator cannot be qualified}}
103 int A2::RC::x; // expected-error{{non-static data member defined out-of-line}}
105 void A2::CC::NC::m(); // expected-error{{out-of-line declaration of a member must be a definition}}
117 return E::X; // expected-error{{expected a class or namespace}}
124 Operators operator+(const Operators&) const; // expected-note{{member declaration nearly matches}}
128 Operators Operators::operator+(const Operators&) { // expected-error{{out-of-line definition of 'operator+' does not match any declaration in 'Operators'}}
133 Operators Operators::operator+(const Operators&) const {
138 Operators::operator bool() {
143 void g(int&); // expected-note{{member declaration nearly matches}}
146 void A::f() {} // expected-error{{out-of-line definition of 'f' does not match any declaration in namespace 'A'}}
148 void A::g(const int&) { } // expected-error{{out-of-line definition of 'g' does not match any declaration in namespace 'A'}}
152 void Struct::f() { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'Struct'}}
154 void global_func(int);
155 void global_func2(int);
158 void ::global_func(int) { } // expected-error{{definition or redeclaration of 'global_func' cannot name the global scope}}
161 // FIXME: if we move this to a separate definition of N, things break!
163 void ::global_func2(int) { } // expected-error{{definition or redeclaration of 'global_func2' cannot name the global scope}}
165 void N::f() { } // okay
167 struct Y; // expected-note{{forward declaration of 'Y'}}
168 Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \
169 // expected-error{{no type named 'foo' in}}
171 X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
172 // expected-error{{C++ requires a type specifier for all declarations}} \
173 // expected-error{{only constructors take base initializers}}
182 struct a { }; // expected-note{{candidate constructor (the implicit copy constructor)}}
185 template <typename T>
191 foo<somens:a> a2; // expected-error {{unexpected ':' in nested name specifier}}
193 somens::a a3 = a2; // expected-error {{no viable conversion}}
195 // typedefs and using declarations.
198 class Counter { static int count; };
199 typedef Counter counter;
212 // We still need to do lookup in the lexical scope, even if we push a
213 // non-lexical scope.
216 extern int *count_ptr;
222 int *ns::count_ptr = &count;
225 // PR6259, invalid case
227 // FIXME: this should really only trigger once
228 class A; // expected-note 2 {{forward declaration}}
229 void foo(const char *path) {
230 A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}}