[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CXX / dcl.decl / dcl.meaning / dcl.fct / p6-0x.cpp
blobd93cc8b90874d5c1a89166995f3b9e2fde24b1a6
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s
4 void f0() &; // expected-error {{non-member function cannot have '&' qualifier}}
5 void f1() &&; // expected-error {{non-member function cannot have '&&' qualifier}}
6 void f2() const volatile &&; // expected-error {{non-member function cannot have 'const volatile &&' qualifier}}
8 struct X {
9 void f0() &;
10 void f1() &&;
11 static void f2() &; // expected-error{{static member function cannot have '&' qualifier}}
12 static void f3() &&; // expected-error{{static member function cannot have '&&' qualifier}}
15 typedef void func_type_lvalue() &;
16 typedef void func_type_rvalue() &&;
18 typedef func_type_lvalue *func_type_lvalue_ptr; // expected-error{{pointer to function type 'func_type_lvalue' (aka 'void () &') cannot have '&' qualifier}}
19 typedef func_type_rvalue *func_type_rvalue_ptr; // expected-error{{pointer to function type 'func_type_rvalue' (aka 'void () &&') cannot have '&&' qualifier}}
21 typedef func_type_lvalue &func_type_lvalue_ref; // expected-error{{reference to function type 'func_type_lvalue' (aka 'void () &') cannot have '&' qualifier}}
22 typedef func_type_rvalue &func_type_rvalue_ref; // expected-error{{reference to function type 'func_type_rvalue' (aka 'void () &&') cannot have '&&' qualifier}}
24 template<typename T = func_type_lvalue> struct wrap {
25 typedef T val;
26 typedef T *ptr; // expected-error-re 2{{pointer to function type '{{.*}}' cannot have '{{&|&&}}' qualifier}}
27 typedef T &ref; // expected-error-re 2{{reference to function type '{{.*}}' cannot have '{{&|&&}}' qualifier}}
30 using func_type_lvalue = wrap<>::val; // expected-note{{in instantiation of}}
31 using func_type_lvalue = wrap<func_type_lvalue>::val;
32 using func_type_rvalue = wrap<func_type_rvalue>::val; // expected-note{{in instantiation of}}
34 using func_type_lvalue_ptr = wrap<>::ptr;
35 using func_type_lvalue_ptr = wrap<func_type_lvalue>::ptr;
36 using func_type_rvalue_ptr = wrap<func_type_rvalue>::ptr;
38 using func_type_lvalue_ref = wrap<>::ref;
39 using func_type_lvalue_ref = wrap<func_type_lvalue>::ref;
40 using func_type_rvalue_ref = wrap<func_type_rvalue>::ref;
42 func_type_lvalue f2; // expected-error{{non-member function of type 'func_type_lvalue' (aka 'void () &') cannot have '&' qualifier}}
43 func_type_rvalue f3; // expected-error{{non-member function of type 'func_type_rvalue' (aka 'void () &&') cannot have '&&' qualifier}}
45 struct Y {
46 func_type_lvalue f0;
47 func_type_rvalue f1;
50 void (X::*mpf1)() & = &X::f0;
51 void (X::*mpf2)() && = &X::f1;
54 void (f() &&); // expected-error{{non-member function cannot have '&&' qualifier}}
56 // FIXME: These are ill-formed.
57 template<typename T> struct pass {
58 void f(T);
60 pass<func_type_lvalue> pass0;
61 pass<func_type_lvalue> pass1;
63 template<typename T, typename U> struct is_same { static const bool value = false; };
64 template<typename T> struct is_same<T, T> { static const bool value = true; };
65 constexpr bool cxx1z = __cplusplus > 201402L;
67 void noexcept_true() noexcept(true);
68 void noexcept_false() noexcept(false);
69 using func_type_noexcept_true = wrap<decltype(noexcept_true)>;
70 using func_type_noexcept_false = wrap<decltype(noexcept_false)>;
71 static_assert(is_same<func_type_noexcept_false, func_type_noexcept_true>::value == !cxx1z, "");
72 static_assert(is_same<func_type_noexcept_false::val, func_type_noexcept_true::val>::value == !cxx1z, "");
73 static_assert(is_same<func_type_noexcept_false::ptr, func_type_noexcept_true::ptr>::value == !cxx1z, "");
74 static_assert(is_same<func_type_noexcept_false::ref, func_type_noexcept_true::ref>::value == !cxx1z, "");