From 2c1721f12297bb881f7f9deb383fe6616d835272 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 12 Nov 2013 09:16:15 +0000 Subject: [PATCH] Tests for core issue 201-215. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194458 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CXX/drs/dr2xx.cpp | 101 +++++++++++++++++++++++++++++++++++++++++ www/cxx_dr_status.html | 22 ++++----- 2 files changed, 112 insertions(+), 11 deletions(-) diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp index b74c618084..c714acdff9 100644 --- a/test/CXX/drs/dr2xx.cpp +++ b/test/CXX/drs/dr2xx.cpp @@ -2,6 +2,12 @@ // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +#if __cplusplus < 201103L +#define fold(x) (__builtin_constant_p(x) ? (x) : (x)) +#else +#define fold +#endif + namespace dr200 { // dr200: dup 214 template T f(int); template T f(U) = delete; // expected-error 0-1{{extension}} @@ -10,3 +16,98 @@ namespace dr200 { // dr200: dup 214 f(1); } } + +// dr201 FIXME: write codegen test + +namespace dr202 { // dr202: yes + template T f(); + template struct X { + int arr[fold(g == &f) ? 1 : -1]; + }; + template struct X; +} + +// FIXME (export) dr204: no + +namespace dr206 { // dr206: yes + struct S; // expected-note 2{{declaration}} + template struct Q { S s; }; // expected-error {{incomplete}} + template void f() { S s; } // expected-error {{incomplete}} +} + +namespace dr207 { // dr207: yes + class A { + protected: + static void f() {} + }; + class B : A { + public: + using A::f; + void g() { + A::f(); + f(); + } + }; +} + +// dr208 FIXME: write codegen test + +namespace dr209 { // dr209: yes + class A { + void f(); // expected-note {{here}} + }; + class B { + friend void A::f(); // expected-error {{private}} + }; +} + +// dr210 FIXME: write codegen test + +namespace dr211 { // dr211: yes + struct A { + A() try { + throw 0; + } catch (...) { + return; // expected-error {{return in the catch of a function try block of a constructor}} + } + }; +} + +namespace dr213 { // dr213: yes + template struct A : T { + void h(T t) { + char &r1 = f(t); + int &r2 = g(t); // expected-error {{undeclared}} + } + }; + struct B { + int &f(B); + int &g(B); // expected-note {{in dependent base class}} + }; + char &f(B); + + template void A::h(B); // expected-note {{instantiation}} +} + +namespace dr214 { // dr214: yes + template T checked_cast(U from) { U::error; } + template T checked_cast(U *from); + class C {}; + void foo(int *arg) { checked_cast(arg); } + + template T f(int); + template T f(U) { T::error; } + void g() { + f(1); + } +} + +namespace dr215 { // dr215: yes + template class X { + friend void T::foo(); + int n; + }; + struct Y { + void foo() { (void)+X().n; } + }; +} diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index 814e3e0662..43566ccaf4 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -632,7 +632,7 @@ 99 NAD Partial ordering, references and cv-qualifiers - Superseded by 214 + Superseded by 214 100 @@ -1238,7 +1238,7 @@ 200 dup Partial ordering and explicit arguments - Duplicate of 214 + Duplicate of 214 201 @@ -1250,7 +1250,7 @@ 202 TC1 Use of overloaded function name - Unknown + Yes 203 @@ -1262,7 +1262,7 @@ 204 CD1 Exported class templates - Unknown + No 205 @@ -1274,13 +1274,13 @@ 206 TC1 Semantic constraints on non-dependent names - Unknown + Yes 207 CD1 using-declarations and protected access - Unknown + Yes 208 @@ -1293,7 +1293,7 @@ NAD Must friend declaration names be accessible? - Unknown + Yes 210 @@ -1305,7 +1305,7 @@ accessible? 211 NAD Constructors should not be allowed to return normally after an exception - Unknown + Yes 212 @@ -1317,19 +1317,19 @@ accessible? 213 TC1 Lookup in dependent base classes - Unknown + Yes 214 CD1 Partial ordering of function templates is underspecified - Unknown + Yes 215 CD1 Template parameters are not allowed in nested-name-specifiers - Unknown + Yes 216 -- 2.40.0