From 788bd00c123e46de5a3896c4dc3a6389a1bb1d3f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 15 Sep 2014 22:56:03 +0000 Subject: [PATCH] Tests for DR581-600. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217844 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CXX/drs/dr5xx.cpp | 140 +++++++++++++++++++++++++++++++++++++++++ www/cxx_dr_status.html | 32 +++++----- 2 files changed, 156 insertions(+), 16 deletions(-) diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp index 770e32278f..3872295d03 100644 --- a/test/CXX/drs/dr5xx.cpp +++ b/test/CXX/drs/dr5xx.cpp @@ -852,3 +852,143 @@ namespace dr580 { // dr580: no C A::c; C B::c; // expected-error 2{{private}} } + +// dr582: na + +namespace dr583 { // dr583: no + // see n3624 + int *p; + // FIXME: These are all ill-formed. + bool b1 = p < 0; + bool b2 = p > 0; + bool b3 = p <= 0; + bool b4 = p >= 0; +} + +// dr584: na + +namespace dr585 { // dr585: yes + template struct T; + struct A { + friend T; // expected-error {{requires a type specifier}} expected-error {{can only be classes or functions}} + // FIXME: It's not clear whether the standard allows this or what it means, + // but the DR585 writeup suggests it as an alternative. + template friend T; // expected-error {{must use an elaborated type}} + }; + template class T> struct B { + friend T; // expected-error {{requires a type specifier}} expected-error {{can only be classes or functions}} + template friend T; // expected-error {{must use an elaborated type}} + }; +} + +// dr586: na + +namespace dr587 { // dr587: yes + template void f(bool b, const T x, T y) { + const T *p = &(b ? x : y); + } + struct S {}; + template void f(bool, const int, int); + template void f(bool, const S, S); +} + +namespace dr588 { // dr588: yes + struct A { int n; }; // expected-note {{ambiguous}} + template int f() { + struct S : A, T { int f() { return n; } } s; + int a = s.f(); + int b = s.n; // expected-error {{found in multiple}} + } + struct B { int n; }; // expected-note {{ambiguous}} + int k = f(); // expected-note {{here}} +} + +namespace dr589 { // dr589: yes + struct B { }; + struct D : B { }; + D f(); + extern const B &b; + bool a; + const B *p = &(a ? f() : b); // expected-error {{temporary}} + const B *q = &(a ? D() : b); // expected-error {{temporary}} +} + +namespace dr590 { // dr590: yes + template struct A { + struct B { + struct C { + A::B::C f(A::B::C); // ok, no 'typename' required. + }; + }; + }; + template typename A::B::C A::B::C::f(A::B::C) {} +} + +namespace dr591 { // dr591: no + template struct A { + typedef int M; + struct B { + typedef void M; + struct C; + }; + }; + + template struct A::B::C : A { + // FIXME: Should find member of non-dependent base class A. + M m; // expected-error {{incomplete type 'M' (aka 'void'}} + }; +} + +// dr592: na +// dr593 needs an IRGen test. +// dr594: na + +namespace dr595 { // dr595: dup 1330 + template struct X { + void f() throw(T) {} + }; + struct S { + X xs; + }; +} + +// dr597: na + +namespace dr598 { // dr598: yes + namespace N { + void f(int); + void f(char); + // Not found by ADL. + void g(void (*)(int)); + void h(void (*)(int)); + + namespace M { + struct S {}; + int &h(void (*)(S)); + } + void i(M::S); + void i(); + } + int &g(void(*)(char)); + int &r = g(N::f); + int &s = h(N::f); // expected-error {{undeclared}} + int &t = h(N::i); +} + +namespace dr599 { // dr599: partial + typedef int Fn(); + struct S { operator void*(); }; + struct T { operator Fn*(); }; + struct U { operator int*(); operator void*(); }; // expected-note 2{{conversion}} + struct V { operator int*(); operator Fn*(); }; + void f(void *p, void (*q)(), S s, T t, U u, V v) { + delete p; // expected-error {{cannot delete}} + delete q; // expected-error {{cannot delete}} + delete s; // expected-error {{cannot delete}} + delete t; // expected-error {{cannot delete}} + // FIXME: This is valid, but is rejected due to a non-conforming GNU + // extension allowing deletion of pointers to void. + delete u; // expected-error {{ambiguous}} + delete v; + } +} diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index 3ae5fc1473..96b593aa68 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -3535,67 +3535,67 @@ and POD class 582 CD1 Template conversion functions - Unknown + N/A 583 CD3 Relational pointer comparisons against the null pointer constant - Unknown + No 584 NAD Unions and aliasing - Unknown + N/A 585 NAD Friend template template parameters - Unknown + Yes 586 NAD Default template-arguments and template argument deduction - Unknown + N/A 587 CD2 Lvalue operands of a conditional expression differing only in cv-qualification - Unknown + Yes 588 CD2 Searching dependent bases of classes local to function templates - Unknown + Yes 589 CD2 Direct binding of class and array rvalues in reference initialization - Unknown + Yes 590 C++11 Nested classes and the “current instantiation” - Unknown + Yes 591 ready When a dependent base class is the current instantiation - Unknown + No 592 CD1 Exceptions during construction of local static objects - Unknown + N/A 593 @@ -3607,13 +3607,13 @@ and POD class 594 CD1 Coordinating issues 119 and 404 with delegating constructors - Unknown + N/A 595 dup Exception specifications in templates instantiated from class bodies - Unknown + Duplicate of 1330 596 @@ -3625,19 +3625,19 @@ and POD class 597 CD3 Conversions applied to out-of-lifetime non-POD lvalues - Unknown + N/A 598 CD2 Associated namespaces of overloaded functions and function templates - Unknown + Yes 599 CD2 Deleting a null function pointer - Unknown + Partial 600 -- 2.40.0