2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2009-02-08 03:52:04 +08:00
|
|
|
namespace A { // expected-note 2 {{previous definition is here}}
|
2008-04-29 12:43:50 +08:00
|
|
|
int A;
|
|
|
|
void f() { A = 0; }
|
|
|
|
}
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
void f() { A = 0; } // expected-error {{unexpected namespace name 'A': expected expression}}
|
|
|
|
int A; // expected-error {{redefinition of 'A' as different kind of symbol}}
|
|
|
|
class A; // expected-error {{redefinition of 'A' as different kind of symbol}}
|
2008-04-29 12:43:50 +08:00
|
|
|
|
2009-10-01 05:46:01 +08:00
|
|
|
class B {}; // expected-note {{previous definition is here}} \
|
|
|
|
// FIXME: ugly expected-note{{candidate function}}
|
2008-04-29 12:43:50 +08:00
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
void C(); // expected-note {{previous definition is here}}
|
|
|
|
namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}}
|
2008-05-10 07:39:43 +08:00
|
|
|
|
2008-07-16 15:45:46 +08:00
|
|
|
namespace D {
|
|
|
|
class D {};
|
|
|
|
}
|
|
|
|
|
2008-05-10 07:39:43 +08:00
|
|
|
namespace S1 {
|
|
|
|
int x;
|
|
|
|
|
|
|
|
namespace S2 {
|
|
|
|
|
|
|
|
namespace S3 {
|
|
|
|
B x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace S1 {
|
|
|
|
void f() {
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace S2 {
|
|
|
|
|
|
|
|
namespace S3 {
|
|
|
|
void f() {
|
2009-05-21 19:50:50 +08:00
|
|
|
x = 0; // expected-error {{no viable overloaded '='}}
|
2008-05-10 07:39:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace S1 {
|
|
|
|
namespace S2 {
|
|
|
|
namespace S3 {
|
|
|
|
void f3() {
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-12 00:49:14 +08:00
|
|
|
|
|
|
|
namespace B {} // expected-error {{redefinition of 'B' as different kind of symbol}}
|
2009-04-15 06:17:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
namespace foo {
|
|
|
|
enum x {
|
|
|
|
Y
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
static foo::x test1; // ok
|
|
|
|
|
|
|
|
static foo::X test2; // typo: expected-error {{unknown type name 'X'}}
|