diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index fbe67bd0c2f6d..1d76804907a5c 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -1,16 +1,169 @@ -// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,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-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-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,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-cxx20,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-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// 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,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-cxx17,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,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-cxx17,since-cxx20,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-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) // cxx98-error@-1 {{variadic macros are a C99 feature}} #endif +namespace dr1800 { // dr1800: 2.9 +struct A { union { int n; }; }; +static_assert(__is_same(__decltype(&A::n), int A::*), ""); +} // namespace dr1800 + +namespace dr1801 { // dr1801: 2.8 +static union { + int i; +}; + +template struct S {}; // #dr1801-S +S V; // #dr1801-S-i +// cxx98-14-error@-1 {{non-type template argument does not refer to any declaration}} +// cxx98-14-note@#dr1801-S {{template parameter is declared here}} +// since-cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}} +} + +namespace dr1802 { // dr1802: 3.1 +#if __cplusplus >= 201103L +// Using a Wikipedia example of surrogate pair: +// https://en.wikipedia.org/wiki/UTF-16#Examples +constexpr char16_t a[3] = u"\U00010437"; +static_assert(a[0] == 0xD801, ""); +static_assert(a[1] == 0xDC37, ""); +static_assert(a[2] == 0x0, ""); +#endif +} // namespace dr1802 + +namespace dr1803 { // dr1803: 2.9 +#if __cplusplus >= 201103L +struct A { + enum E : int; + enum E : int {}; + enum class EC; + enum class EC {}; + enum struct ES; + enum struct ES {}; +}; +#endif +} // namespace dr1803 + +namespace dr1804 { // dr1804: 2.7 +template +struct A { + void f1(); + + template + void f2(V); + + class B { + void f3(); + }; + + template + class C { + void f4(); + }; +}; + +template +struct A { + void f1(); + + template + void f2(V); + + class B { + void f3(); + }; + + template + class C { + void f4(); + }; +}; + +class D { + int i; + + template + friend struct A; +}; + +template +struct A { + void f1(); + + template + void f2(V); + + class B { + void f3(); + }; + + template + class C { + void f4(); + }; +}; + +template +void A::f1() { + D d; + d.i = 0; +} + +template +void A::f1() { + D d; + d.i = 0; +} + +template +template +void A::f2(V) { + D d; + d.i = 0; +} + +template +template +void A::f2(V) { + D d; + d.i = 0; +} + +template +void A::B::f3() { + D d; + d.i = 0; +} + +template +void A::B::f3() { + D d; + d.i = 0; +} + +template +template +void A::C::f4() { + D d; + d.i = 0; +} + +template +template +void A::C::f4() { + D d; + d.i = 0; +} +} // namespace dr1804 + namespace dr1812 { // dr1812: no // NB: dup 1710 #if __cplusplus >= 201103L diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 22eb7ac63c7ed..2bded63d5cd41 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -2661,7 +2661,7 @@

C++ defect report implementation status

437 CD1 Is type of class allowed in member function exception specification? - Superseded by 1308 + Superseded by 1308 438 @@ -10607,31 +10607,31 @@

C++ defect report implementation status

1800 CD4 Pointer to member of nested anonymous union - Unknown + Clang 2.9 1801 CD4 Kind of expression referring to member of anonymous union - Unknown + Clang 2.8 1802 CD4 char16_t string literals and surrogate pairs - Unknown + Clang 3.1 1803 CD5 opaque-enum-declaration as member-declaration - Unknown + Clang 2.9 1804 CD4 Partial specialization and friendship - Unknown + Clang 2.7 1805