diff --git a/clang/test/CXX/drs/cwg0xx.cpp b/clang/test/CXX/drs/cwg0xx.cpp index 2e2e6d4e662d63..ca969dc5fcec1a 100644 --- a/clang/test/CXX/drs/cwg0xx.cpp +++ b/clang/test/CXX/drs/cwg0xx.cpp @@ -709,11 +709,11 @@ namespace cwg39 { // cwg39: no // expected-error@#cwg39-sizeof {{unknown type name}} #if __cplusplus >= 201103L decltype(D::n) n; - /* expected-error@-1 + /* since-cxx11-error@-1 {{non-static member 'n' found in multiple base-class subobjects of type 'A': struct cwg39::PR5916::D -> B -> A struct cwg39::PR5916::D -> C -> A}} */ - // expected-note@#cwg39-A-n {{member found by ambiguous name lookup}} + // since-cxx11-note@#cwg39-A-n {{member found by ambiguous name lookup}} #endif } } // namespace cwg39 @@ -1150,8 +1150,8 @@ namespace cwg73 { // cwg73: sup 1652 #if __cplusplus >= 201103L int a, b; static_assert(&a + 1 != &b, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}} #endif } // namespace cwg73 @@ -1255,14 +1255,14 @@ namespace cwg85 { // cwg85: 3.4 enum E1 : int; enum E1 : int { e1 }; // #cwg85-E1-def enum E1 : int; - // expected-error@-1 {{class member cannot be redeclared}} - // expected-note@#cwg85-E1-def {{previous declaration is here}} + // since-cxx11-error@-1 {{class member cannot be redeclared}} + // since-cxx11-note@#cwg85-E1-def {{previous declaration is here}} enum class E2; enum class E2 { e2 }; // #cwg85-E2-def enum class E2; - // expected-error@-1 {{class member cannot be redeclared}} - // expected-note@#cwg85-E2-def {{previous declaration is here}} + // since-cxx11-error@-1 {{class member cannot be redeclared}} + // since-cxx11-note@#cwg85-E2-def {{previous declaration is here}} #endif }; diff --git a/clang/test/CXX/drs/cwg14xx.cpp b/clang/test/CXX/drs/cwg14xx.cpp index 149468eb292c96..8f9de5373e757b 100644 --- a/clang/test/CXX/drs/cwg14xx.cpp +++ b/clang/test/CXX/drs/cwg14xx.cpp @@ -93,7 +93,7 @@ struct A; void f() { constexpr A* a = nullptr; constexpr int p = &*a; - // expected-error@-1 {{cannot initialize a variable of type 'const int' with an rvalue of type 'A *'}} + // since-cxx11-error@-1 {{cannot initialize a variable of type 'const int' with an rvalue of type 'A *'}} constexpr A *p2 = &*a; } @@ -108,27 +108,27 @@ namespace cwg1460 { // cwg1460: 3.5 namespace DRExample { union A { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} constexpr A() {} }; constexpr A a = A(); union B { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} constexpr B() = default; }; constexpr B b = B(); union C { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} }; constexpr C c = C(); #if __cplusplus >= 201403L @@ -141,7 +141,7 @@ namespace cwg1460 { // cwg1460: 3.5 union B { int n; }; // #cwg1460-B union C { int n = 0; }; struct D { union {}; }; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} struct E { union { int n; }; }; // #cwg1460-E struct F { union { int n = 0; }; }; @@ -173,7 +173,7 @@ namespace cwg1460 { // cwg1460: 3.5 // cxx11-17-error@-1 {{defaulted definition of default constructor cannot be marked constexpr}} union C { int n = 0; constexpr C() = default; }; struct D { union {}; constexpr D() = default; }; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} struct E { union { int n; }; constexpr E() = default; }; // cxx11-17-error@-1 {{defaulted definition of default constructor cannot be marked constexpr}} struct F { union { int n = 0; }; constexpr F() = default; }; @@ -222,8 +222,8 @@ namespace cwg1460 { // cwg1460: 3.5 union G { int a = 0; // #cwg1460-G-a int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-G-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-G-a {{previous initialization is here}} }; union H { union { @@ -231,16 +231,16 @@ namespace cwg1460 { // cwg1460: 3.5 }; union { int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-H-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-H-a {{previous initialization is here}} }; }; struct I { union { int a = 0; // #cwg1460-I-a int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-I-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-I-a {{previous initialization is here}} }; }; struct J { @@ -264,23 +264,23 @@ namespace cwg1460 { // cwg1460: 3.5 }; static_assert(B().a == 1, ""); static_assert(B().b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} static_assert(B('x').a == 0, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(B('x').b == 4, ""); static_assert(B(123).b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} static_assert(B(123).c == 3, ""); static_assert(B("").a == 1, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(B("").b == 2, ""); static_assert(B("").c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} struct C { union { int a, b = 2, c; }; @@ -294,54 +294,54 @@ namespace cwg1460 { // cwg1460: 3.5 static_assert(C().a == 1, ""); static_assert(C().b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} static_assert(C().d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C().e == 5, ""); static_assert(C('x').b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} static_assert(C('x').c == 3, ""); static_assert(C('x').d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C('x').e == 5, ""); static_assert(C(1).b == 2, ""); static_assert(C(1).c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C(1).d == 4, ""); static_assert(C(1).e == 5, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'e' of union with active member 'd' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'e' of union with active member 'd' is not allowed in a constant expression}} static_assert(C(1.f).b == 2, ""); static_assert(C(1.f).c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C(1.f).e == 5, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'e' of union with active member 'f' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'e' of union with active member 'f' is not allowed in a constant expression}} static_assert(C(1.f).f == 6, ""); static_assert(C("").a == 1, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(C("").b == 2, ""); static_assert(C("").c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C("").d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C("").e == 5, ""); static_assert(C("").f == 6, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'f' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'f' of union with active member 'e' is not allowed in a constant expression}} struct D; extern const D d; diff --git a/clang/test/CXX/drs/cwg18xx.cpp b/clang/test/CXX/drs/cwg18xx.cpp index 4beeb41ac3728d..e9993326bb058d 100644 --- a/clang/test/CXX/drs/cwg18xx.cpp +++ b/clang/test/CXX/drs/cwg18xx.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,cxx98-14,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors @@ -274,8 +274,8 @@ void d2() { #if __cplusplus >= 201103L auto e = [] { typedef int cwg1820::A; - // expected-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}} - // expected-error@-2 {{typedef declarator cannot be qualified}} + // since-cxx11-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}} + // since-cxx11-error@-2 {{typedef declarator cannot be qualified}} }; #endif } // namespace cwg1820 @@ -325,9 +325,9 @@ enum E { // #cwg1832-E #if __cplusplus >= 201103L enum E2: decltype(static_cast(0), 0) {}; -// expected-error@-1 {{unknown type name 'E2'}} +// since-cxx11-error@-1 {{unknown type name 'E2'}} enum class E3: decltype(static_cast(0), 0) {}; -// expected-error@-1 {{unknown type name 'E3'}} +// since-cxx11-error@-1 {{unknown type name 'E3'}} #endif } // namespace cwg1832 @@ -488,15 +488,12 @@ namespace cwg1872 { // cwg1872: 9 // cxx11-17-error@-1 {{constexpr variable 'y2' must be initialized by a constant expression}} // cxx11-17-note@-2 {{cannot evaluate call to virtual function in a constant expression in C++ standards before C++20}} #if __cplusplus >= 202002L - static_assert(y == 0); + static_assert(y2 == 0); #endif constexpr int z = A().f(); - // since-cxx11-error@-1 {{constexpr variable 'z' must be initialized by a constant expression}}a -#if __cplusplus < 202302L - // since-cxx11-note@-3 {{non-literal type 'A' cannot be used in a constant expression}} -#else - // since-cxx23-note@-5 {{cannot construct object of type 'A' with virtual base class in a constant expression}} -#endif + // since-cxx11-error@-1 {{constexpr variable 'z' must be initialized by a constant expression}} + // cxx11-20-note@-2 {{non-literal type 'A' cannot be used in a constant expression}} + // since-cxx23-note@-3 {{cannot construct object of type 'A' with virtual base class in a constant expression}} #endif } // namespace cwg1872 diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp index 39dfd310e93a3f..f968ab9c20b276 100644 --- a/clang/test/CXX/drs/cwg1xx.cpp +++ b/clang/test/CXX/drs/cwg1xx.cpp @@ -279,19 +279,19 @@ namespace cwg115 { // cwg115: 3.0 // Special case kicks in only if a template argument list is specified. template void with_default(); // #cwg115-with-default int k10 = f(&with_default); - // expected-error@-1 {{no matching function for call to 'f'}} - // expected-note@#cwg115-f {{candidate template ignored: couldn't infer template argument 'T'}} + // since-cxx11-error@-1 {{no matching function for call to 'f'}} + // since-cxx11-note@#cwg115-f {{candidate template ignored: couldn't infer template argument 'T'}} int k11 = f(&with_default<>); void k() { (void)&with_default; - // expected-error@-1 {{address of overloaded function 'with_default' cannot be cast to type 'void'}} - // expected-note@#cwg115-with-default {{candidate function template}} + // since-cxx11-error@-1 {{address of overloaded function 'with_default' cannot be cast to type 'void'}} + // since-cxx11-note@#cwg115-with-default {{candidate function template}} (void)&with_default<>; &with_default; - // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} - // expected-note@#cwg115-with-default {{possible target for call}} + // since-cxx11-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} + // since-cxx11-note@#cwg115-with-default {{possible target for call}} &with_default<>; - // expected-warning@-1 {{expression result unused}} + // since-cxx11-warning@-1 {{expression result unused}} } #endif } // namespace cwg115 diff --git a/clang/test/CXX/drs/cwg2335.cpp b/clang/test/CXX/drs/cwg2335.cpp index 8b00a9d2d98a5e..805c272f2f6199 100644 --- a/clang/test/CXX/drs/cwg2335.cpp +++ b/clang/test/CXX/drs/cwg2335.cpp @@ -1,14 +1,12 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx98-11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors -#if __cplusplus <= 201103L -// expected-no-diagnostics -#endif +// cxx98-11-no-diagnostics namespace cwg2335 { // cwg2335: no drafting 2018-06 // FIXME: current consensus is that the examples are well-formed. diff --git a/clang/test/CXX/drs/cwg23xx.cpp b/clang/test/CXX/drs/cwg23xx.cpp index 0169d9c2a0332b..7ab66ce89f2868 100644 --- a/clang/test/CXX/drs/cwg23xx.cpp +++ b/clang/test/CXX/drs/cwg23xx.cpp @@ -341,26 +341,26 @@ enum E1 : int; struct A { friend enum class E0; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} friend enum E0; - // expected-error@-1 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-2 {{remove 'enum' to befriend an enum}} + // since-cxx11-error@-1 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-2 {{remove 'enum' to befriend an enum}} friend enum class E1; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} friend enum E1; - // expected-error@-1 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-2 {{remove 'enum' to befriend an enum}} + // since-cxx11-error@-1 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-2 {{remove 'enum' to befriend an enum}} friend enum class E2; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} }; #endif } // namespace cwg2363 diff --git a/clang/test/CXX/drs/cwg24xx.cpp b/clang/test/CXX/drs/cwg24xx.cpp index 316622460e147f..9c9a3f14b9e8be 100644 --- a/clang/test/CXX/drs/cwg24xx.cpp +++ b/clang/test/CXX/drs/cwg24xx.cpp @@ -2,9 +2,9 @@ // RUN: %clang_cc1 -std=c++11 -pedantic-errors %s -verify=expected,cxx98-14 // RUN: %clang_cc1 -std=c++14 -pedantic-errors %s -verify=expected,cxx98-14 // RUN: %clang_cc1 -std=c++17 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++20 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++23 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++2c -pedantic-errors %s -verify=expected,since-cxx17 +// RUN: %clang_cc1 -std=c++20 -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 +// RUN: %clang_cc1 -std=c++23 -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 +// RUN: %clang_cc1 -std=c++2c -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 namespace cwg2406 { // cwg2406: 5 #if __cplusplus >= 201703L @@ -48,45 +48,45 @@ concept C [[deprecated]] = true; // #cwg2428-C template [[deprecated]] concept C2 = true; -// expected-error@-1 {{expected unqualified-id}} +// since-cxx20-error@-1 {{expected unqualified-id}} template concept C3 = C; -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} template -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} requires C -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} void f() { bool b = C; - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} }; void g(C auto a) {}; -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} template auto h() -> C auto { -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto foo = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto *bar = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto &baz = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto &&quux = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} return foo; } #endif diff --git a/clang/test/CXX/drs/cwg25xx.cpp b/clang/test/CXX/drs/cwg25xx.cpp index a6e2396f849699..d9a7d2bbb26715 100644 --- a/clang/test/CXX/drs/cwg25xx.cpp +++ b/clang/test/CXX/drs/cwg25xx.cpp @@ -86,8 +86,8 @@ operator"" _div(); // since-cxx11-warning@-1 {{identifier '_div' preceded by whitespace in a literal operator declaration is deprecated}} using ::cwg2521::operator"" _\u03C0___; +// since-cxx11-warning@-1 {{identifier '_π___' preceded by whitespace in a literal operator declaration is deprecated}} using ::cwg2521::operator""_div; -// since-cxx11-warning@-2 {{identifier '_π___' preceded by whitespace in a literal operator declaration is deprecated}} long double operator"" _RESERVED(long double); // since-cxx11-warning@-1 {{identifier '_RESERVED' preceded by whitespace in a literal operator declaration is deprecated}} @@ -206,7 +206,7 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 struct TwoParamsStruct{}; using TPSU = TwoParamsStruct; - // since-cxx20-error@-1 {{constraints not satisfied for class template 'TwoParamsStruct'}} + // since-cxx20-error@-1 {{constraints not satisfied for class template 'TwoParamsStruct' [with T = void, U = void]}} // since-cxx20-note@#cwg2565-TPSREQ {{because 'TwoParams' evaluated to false}} // since-cxx20-note@#cwg2565-TPC {{because 'b' would be invalid: argument may not have 'void' type}} @@ -218,15 +218,15 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 struct VariadicStruct{}; using VSU = VariadicStruct; - // since-cxx20-error@-1 {{constraints not satisfied for class template 'VariadicStruct'}} + // since-cxx20-error@-1 {{constraints not satisfied for class template 'VariadicStruct' [with T = void, U = ]}} // since-cxx20-note@#cwg2565-VSREQ {{because 'Variadic' evaluated to false}} // since-cxx20-note@#cwg2565-VC {{because 'b' would be invalid: argument may not have 'void' type}} template concept ErrorRequires = requires (ErrorRequires auto x) { - // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} \ - // since-cxx20-error@-1 {{'auto' not allowed in requires expression parameter}} \ - // since-cxx20-note@-1 {{declared here}} + // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} + // since-cxx20-note@-2 {{declared here}} + // since-cxx20-error@-3 {{'auto' not allowed in requires expression parameter}} x; }; static_assert(ErrorRequires); @@ -234,17 +234,17 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 // since-cxx20-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} template - concept NestedErrorInRequires = requires (T x) { // - // since-cxx20-note@-1 {{declared here}} + concept NestedErrorInRequires = requires (T x) { // #cwg2565-NEIR requires requires (NestedErrorInRequires auto y) { - // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} \ - // since-cxx20-error@-1 {{'auto' not allowed in requires expression parameter}} + // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} + // since-cxx20-note@#cwg2565-NEIR {{declared here}} + // since-cxx20-error@-3 {{'auto' not allowed in requires expression parameter}} y; }; }; static_assert(NestedErrorInRequires); - // expected-error@-1 {{static assertion failed}} - // expected-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} + // since-cxx20-error@-1 {{static assertion failed}} + // since-cxx20-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} #endif } // namespace cwg2565 @@ -286,10 +286,10 @@ struct X { // e.g., "if an explicit object parameter is used it must be of type reference to 'X'" X& operator=(this int, const X&) = default; // since-cxx23-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} - // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} + // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} X& operator=(this X, const X&) = default; // since-cxx23-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} - // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} + // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} }; struct Y { void operator=(this int, const Y&); // This is copy constructor, suppresses implicit declaration diff --git a/clang/test/CXX/drs/cwg26xx.cpp b/clang/test/CXX/drs/cwg26xx.cpp index 58e047f72bf7c3..23d7635ff90658 100644 --- a/clang/test/CXX/drs/cwg26xx.cpp +++ b/clang/test/CXX/drs/cwg26xx.cpp @@ -364,16 +364,13 @@ namespace cwg2692 { // cwg2692: 19 void A::g() { (&A::f)(A()); - // expected-error@-1 {{call to 'f' is ambiguous}} - // expected-note@#cwg2692-1 {{candidate}} - // expected-note@#cwg2692-2 {{candidate}} - - - + // since-cxx23-error@-1 {{call to 'f' is ambiguous}} + // since-cxx23-note@#cwg2692-1 {{candidate function}} + // since-cxx23-note@#cwg2692-2 {{candidate function}} (&A::f)(); - // expected-error@-1 {{no matching function for call to 'f'}} - // expected-note@#cwg2692-1 {{candidate function not viable: requires 1 argument, but 0 were provided}} - // expected-note@#cwg2692-2 {{candidate function not viable: requires 1 argument, but 0 were provided}} + // since-cxx23-error@-1 {{no matching function for call to 'f'}} + // since-cxx23-note@#cwg2692-1 {{candidate function not viable: requires 1 argument, but 0 were provided}} + // since-cxx23-note@#cwg2692-2 {{candidate function not viable: requires 1 argument, but 0 were provided}} } #endif } // namespace cwg2692 diff --git a/clang/test/CXX/drs/cwg28xx.cpp b/clang/test/CXX/drs/cwg28xx.cpp index 2cad2814cd6861..caa9b0f1f50583 100644 --- a/clang/test/CXX/drs/cwg28xx.cpp +++ b/clang/test/CXX/drs/cwg28xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -pedantic-errors -verify=expected,cxx98 %s -// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected,cxx11-23 %s -// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected,cxx11-23 %s -// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected,cxx11-23 %s -// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,cxx11-23,since-cxx20 %s -// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,cxx11-23,since-cxx20,since-cxx23 %s -// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s +// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,since-cxx11,cxx11-23,since-cxx20 %s +// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,since-cxx11,cxx11-23,since-cxx20,since-cxx23 %s +// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx11,since-cxx20,since-cxx23,since-cxx26 %s int main() {} // required for cwg2811 @@ -14,14 +14,14 @@ namespace cwg2811 { // cwg2811: 3.5 void f() { (void)[&] { using T = decltype(main); - // expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} + // since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} }; using T2 = decltype(main); - // expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} + // since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} } using T = decltype(main); -// expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} +// since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} int main(); @@ -150,7 +150,7 @@ struct A { // FIXME: The index of the pack-index-specifier is printed as a memory address in the diagnostic. template friend struct Ts...[0]::C; - // expected-warning-re@-1 {{dependent nested name specifier 'Ts...[{{.*}}]::' for friend template declaration is not supported; ignoring this friend declaration}} + // since-cxx26-warning@-1 {{dependent nested name specifier 'Ts...[0]::' for friend template declaration is not supported; ignoring this friend declaration}} }; #endif diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp index b06a073d344460..aeb62b8d687105 100644 --- a/clang/test/CXX/drs/cwg29xx.cpp +++ b/clang/test/CXX/drs/cwg29xx.cpp @@ -22,7 +22,8 @@ template R(T) -> R requires true; template -R(T, T) requires true -> R; // expected-error {{expected function body after function declarator}} +R(T, T) requires true -> R; +// since-cxx20-error@-1 {{expected function body after function declarator}} #endif @@ -31,7 +32,8 @@ R(T, T) requires true -> R; // expected-error {{expected function body after namespace cwg2915 { // cwg2915: 20 #if __cplusplus >= 202302L struct A { - void f(this void); // expected-error {{explicit object parameter cannot have 'void' type}} + void f(this void); + // since-cxx23-error@-1 {{explicit object parameter cannot have 'void' type}} }; #endif } // namespace cwg2915 @@ -63,7 +65,7 @@ namespace std { using size_t = decltype(sizeof(0)); } // namespace std void *operator new(std::size_t, void *p) { return p; } -void* operator new[] (std::size_t, void* p) {return p;} +void* operator new[] (std::size_t, void* p) {return p; } #endif namespace cwg2922 { // cwg2922: 20 @@ -72,14 +74,14 @@ union U { int a, b; }; constexpr U nondeterministic(bool i) { if(i) { U u; - new (&u) int(); - // expected-note@-1 {{placement new would change type of storage from 'U' to 'int'}} + new (&u) int(); // #cwg2922-placement-new return u; } return {}; } constexpr U _ = nondeterministic(true); -// expected-error@-1 {{constexpr variable '_' must be initialized by a constant expression}} \ -// expected-note@-1 {{in call to 'nondeterministic(true)'}} +// since-cxx26-error@-1 {{constexpr variable '_' must be initialized by a constant expression}} +// since-cxx26-note@#cwg2922-placement-new {{placement new would change type of storage from 'U' to 'int'}} +// since-cxx26-note@-3 {{in call to 'nondeterministic(true)'}} #endif } // namespace cwg2922 diff --git a/clang/test/CXX/drs/cwg3xx.cpp b/clang/test/CXX/drs/cwg3xx.cpp index 4404d92cb47dd2..d7319d465a93db 100644 --- a/clang/test/CXX/drs/cwg3xx.cpp +++ b/clang/test/CXX/drs/cwg3xx.cpp @@ -170,9 +170,9 @@ namespace cwg305 { // cwg305: no }; void k(Z *z) { z->~T1(); - // expected-error@-1 {{no member named 'T1' in 'cwg305::Z'}} + // since-cxx11-error@-1 {{no member named 'T1' in 'cwg305::Z'}} z->~T2(); - // expected-error@-1 {{no member named '~int' in 'cwg305::Z'}} + // since-cxx11-error@-1 {{no member named '~int' in 'cwg305::Z'}} z->~T2(); } @@ -182,7 +182,7 @@ namespace cwg305 { // cwg305: no } template using R = Q::R; void qr(Q::R x) { x.~R(); } - // expected-error@-1 {{no member named '~R' in 'cwg305::Q::R'}} + // since-cxx11-error@-1 {{no member named '~R' in 'cwg305::Q::R'}} #endif } // namespace cwg305 diff --git a/clang/test/CXX/drs/cwg4xx.cpp b/clang/test/CXX/drs/cwg4xx.cpp index 8c9f9e4ccb0851..4051496ca2c4f3 100644 --- a/clang/test/CXX/drs/cwg4xx.cpp +++ b/clang/test/CXX/drs/cwg4xx.cpp @@ -836,8 +836,8 @@ namespace cwg450 { // cwg450: yes void h() { f1(A{}); f2(A{}); - // expected-error@-1 {{no matching function for call to 'f2'}}} - // expected-note@#cwg450-f2 {{candidate function not viable: expects an lvalue for 1st argument}} + // since-cxx11-error@-1 {{no matching function for call to 'f2'}}} + // since-cxx11-note@#cwg450-f2 {{candidate function not viable: expects an lvalue for 1st argument}} } #endif } // namespace cwg450 @@ -1274,7 +1274,7 @@ namespace cwg482 { // cwg482: 3.5 #if __cplusplus >= 201103L enum class C; enum class A::C {}; - // expected-error@-1 {{extra qualification on member 'C'}} + // since-cxx11-error@-1 {{extra qualification on member 'C'}} #endif }; } // namespace cwg482 diff --git a/clang/test/CXX/drs/cwg5xx.cpp b/clang/test/CXX/drs/cwg5xx.cpp index 2e78138fd123f4..3df69b5450949c 100644 --- a/clang/test/CXX/drs/cwg5xx.cpp +++ b/clang/test/CXX/drs/cwg5xx.cpp @@ -17,7 +17,7 @@ __extension__ typedef __SIZE_TYPE__ size_t; void *operator new(size_t); // #cwg5xx-global-operator-new // cxx98-error@-1 {{'operator new' is missing exception specification 'throw(std::bad_alloc)'}} -#if __cplusplus > 201402L +#if __cplusplus >= 201703L namespace std { enum class align_val_t : size_t {}; } // namespace std diff --git a/clang/test/CXX/drs/cwg6xx.cpp b/clang/test/CXX/drs/cwg6xx.cpp index 38f440d4154add..c7ef9e1caffe8b 100644 --- a/clang/test/CXX/drs/cwg6xx.cpp +++ b/clang/test/CXX/drs/cwg6xx.cpp @@ -1153,9 +1153,9 @@ namespace cwg684 { // cwg684: sup 1454 void f() { int a; // #cwg684-a constexpr int *p = &a; - // expected-error@-1 {{constexpr variable 'p' must be initialized by a constant expression}} - // expected-note@-2 {{pointer to 'a' is not a constant expression}} - // expected-note@#cwg684-a {{here}} + // since-cxx11-error@-1 {{constexpr variable 'p' must be initialized by a constant expression}} + // since-cxx11-note@-2 {{pointer to 'a' is not a constant expression}} + // since-cxx11-note@#cwg684-a {{here}} } #endif } // namespace cwg684 @@ -1245,12 +1245,12 @@ namespace cwg686 { // cwg686: 3.0 // expected-note@-2 {{forward declaration of 'P'}} catch (struct P {} *) {} // expected-error@-1 {{'P' cannot be defined in a type specifier}} -#if __cplusplus < 201703L +#if __cplusplus <= 201402L void g() throw(struct Q); - // cxx98-17-error@-1 {{incomplete type 'struct Q' is not allowed in exception specification}} - // cxx98-17-note@-2 {{forward declaration of 'Q'}} + // cxx98-14-error@-1 {{incomplete type 'struct Q' is not allowed in exception specification}} + // cxx98-14-note@-2 {{forward declaration of 'Q'}} void h() throw(struct Q {}); - // cxx98-17-error@-1 {{'Q' cannot be defined in a type specifier}} + // cxx98-14-error@-1 {{'Q' cannot be defined in a type specifier}} #endif } template struct X;