[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / MicrosoftSuper.cpp
blobdf63691812ac3dc691d7324563cb9fb556ee9be7
1 // RUN: %clang_cc1 %s -fsyntax-only -fms-extensions -std=c++11 -verify
3 struct Errors {
4 using __super::foo; // expected-error {{'__super' cannot be used with a using declaration}}
5 __super::XXX x; // expected-error {{invalid use of '__super', Errors has no base classes}} expected-error {{expected}}
7 void foo() {
8 // expected-note@+4 {{replace parentheses with an initializer to declare a variable}}
9 // expected-warning@+3 {{empty parentheses interpreted as a function declaration}}
10 // expected-error@+2 {{C++ requires a type specifier for all declarations}}
11 // expected-error@+1 {{use of '__super' inside a lambda is unsupported}}
12 auto lambda = []{ __super::foo(); };
16 struct Base1 {
17 void foo(int) {}
19 static void static_foo() {}
21 typedef int XXX;
24 struct Derived : Base1 {
25 __super::XXX x;
26 typedef __super::XXX Type;
28 enum E {
29 X = sizeof(__super::XXX)
32 void foo() {
33 __super::foo(1);
35 if (true) {
36 __super::foo(1);
39 return __super::foo(1);
42 static void bar() {
43 __super::static_foo();
47 struct Outer {
48 struct Inner : Base1 {
49 static const int x = sizeof(__super::XXX);
53 struct Base2 {
54 void foo(char) {}
57 struct MemberFunctionInMultipleBases : Base1, Base2 {
58 void foo() {
59 __super::foo('x');
63 struct Base3 {
64 void foo(int) {}
65 void foo(char) {}
68 struct OverloadedMemberFunction : Base3 {
69 void foo() {
70 __super::foo('x');
74 struct PointerToMember : Base1 {
75 template <void (Base1::*MP)(int)>
76 struct Wrapper {
77 static void bar() {}
80 void baz();
83 void PointerToMember::baz() {
84 Wrapper<&__super::foo>::bar();
87 template <typename T>
88 struct BaseTemplate {
89 typedef int XXX;
91 int foo() { return 0; }
94 struct DerivedFromKnownSpecialization : BaseTemplate<int> {
95 __super::XXX a;
96 typedef __super::XXX b;
98 void foo() {
99 __super::XXX c;
100 typedef __super::XXX d;
102 __super::foo();
106 template <typename T>
107 struct DerivedFromDependentBase : BaseTemplate<T> {
108 typename __super::XXX a;
109 typedef typename __super::XXX b;
111 __super::XXX c; // expected-error {{missing 'typename'}}
112 typedef __super::XXX d; // expected-error {{missing 'typename'}}
114 void foo() {
115 typename __super::XXX e;
116 typedef typename __super::XXX f;
118 __super::XXX g; // expected-error {{missing 'typename'}}
119 typedef __super::XXX h; // expected-error {{missing 'typename'}}
121 int x = __super::foo();
125 template <typename T>
126 struct DerivedFromTemplateParameter : T {
127 typename __super::XXX a;
128 typedef typename __super::XXX b;
130 __super::XXX c; // expected-error {{missing 'typename'}}
131 typedef __super::XXX d; // expected-error {{missing 'typename'}}
133 void foo() {
134 typename __super::XXX e;
135 typedef typename __super::XXX f;
137 __super::XXX g; // expected-error {{missing 'typename'}}
138 typedef __super::XXX h; // expected-error {{missing 'typename'}}
140 __super::foo(1);
144 void instantiate() {
145 DerivedFromDependentBase<int> d;
146 d.foo();
147 DerivedFromTemplateParameter<Base1> t;
148 t.foo();
151 namespace {
152 struct B { int a; };
153 template <class C>
154 struct A : B {
155 // Don't crash on dependent_type_var '->' '__super'
156 void f() { int a = this->__super::a; }