[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CXX / expr / expr.prim / expr.prim.general / p8-0x.cpp
blob7ab504cbc9e5ab5205818dddc2bb612356bcc4e2
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 struct global {
4 };
6 namespace PR10127 {
7 struct outer {
8 struct middle {
9 struct inner {
10 int func();
11 int i;
13 struct inner2 {
15 struct inner3 {
17 int mfunc();
19 typedef int td_int;
22 struct str {
23 operator decltype(outer::middle::inner()) ();
24 operator decltype(outer::middle())::inner2 ();
25 operator decltype(outer())::middle::inner3 ();
26 str(int (decltype(outer::middle::inner())::*n)(),
27 int (decltype(outer::middle())::inner::*o)(),
28 int (decltype(outer())::middle::inner::*p)());
31 decltype(outer::middle::inner()) a;
32 void scope() {
33 a.decltype(outer::middle())::mfunc(); // expected-error{{'PR10127::outer::middle::mfunc' is not a member of class 'decltype(outer::middle::inner())'}}
34 a.decltype(outer::middle::inner())::func();
35 a.decltype(outer::middle())::inner::func();
36 a.decltype(outer())::middle::inner::func();
38 a.decltype(outer())::middle::inner::~inner();
40 decltype(outer())::middle::inner().func();
42 decltype(outer::middle())::inner b;
43 decltype(outer())::middle::inner c;
44 decltype(outer())::fail d; // expected-error{{no type named 'fail' in 'PR10127::outer'}}
45 decltype(outer())::fail::inner e; // expected-error{{no member named 'fail' in 'PR10127::outer'}}
46 decltype()::fail f; // expected-error{{expected expression}}
47 decltype()::middle::fail g; // expected-error{{expected expression}}
49 decltype(int()) h;
50 decltype(int())::PR10127::outer i; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or enumeration}}
51 decltype(int())::global j; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or enumeration}}
53 outer::middle k = decltype(outer())::middle();
54 outer::middle::inner l = decltype(outer())::middle::inner();
56 template<typename T>
57 struct templ {
58 typename decltype(T())::middle::inner x; // expected-error{{type 'decltype(int())' (aka 'int') cannot be used prior to '::' because it has no members}}
61 template class templ<int>; // expected-note{{in instantiation of template class 'PR10127::templ<int>' requested here}}
62 template class templ<outer>;
64 enum class foo {
65 bar,
66 baz
69 foo m = decltype(foo::bar)::baz;
71 enum E {};
72 enum H {};
73 struct bar {
74 enum E : decltype(outer())::td_int(4); // expected-error{{anonymous bit-field}}
75 enum F : decltype(outer())::td_int;
76 enum G : decltype; // expected-error{{expected '(' after 'decltype'}}
77 enum H : 4; // expected-error {{anonymous bit-field}}