[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / namespace.cpp
blobe2c1516ac3aa9d490d6c649a1e4d306fe126f2da
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 namespace A { // expected-note 2 {{previous definition is here}}
6 int A;
7 void f() { A = 0; }
10 void f() { A = 0; } // expected-error {{unexpected namespace name 'A': expected expression}}
11 int A; // expected-error {{redefinition of 'A' as different kind of symbol}}
12 class A; // expected-error {{redefinition of 'A' as different kind of symbol}}
14 class B {}; // expected-note {{previous definition is here}}
15 // expected-note@-1 {{candidate function (the implicit copy assignment operator) not viable}}
16 #if __cplusplus >= 201103L // C++11 or later
17 // expected-note@-3 {{candidate function (the implicit move assignment operator) not viable}}
18 #endif
20 void C(); // expected-note {{previous definition is here}}
21 namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}}
23 namespace D {
24 class D {};
27 namespace S1 {
28 int x;
30 namespace S2 {
32 namespace S3 {
33 B x;
38 namespace S1 {
39 void f() {
40 x = 0;
43 namespace S2 {
45 namespace S3 {
46 void f() {
47 x = 0; // expected-error {{no viable overloaded '='}}
51 int y;
55 namespace S1 {
56 namespace S2 {
57 namespace S3 {
58 void f3() {
59 y = 0;
65 namespace B {} // expected-error {{redefinition of 'B' as different kind of symbol}}
68 namespace foo {
69 enum x {
74 static foo::x test1; // ok
76 static foo::X test2; // typo: expected-error {{no type named 'X' in}}
78 namespace PR6620 {
79 namespace numeric {
80 namespace op {
81 struct greater {};
83 namespace {
84 extern op::greater const greater;
88 namespace numeric {
89 namespace {
90 op::greater const greater = op::greater();
93 template<typename T, typename U>
94 int f(T& l, U& r)
95 { numeric::greater(l, r); }