From: Richard Smith Date: Tue, 11 Mar 2014 07:49:32 +0000 (+0000) Subject: Tests for DR381-388. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a30c4625fc346ed85a1f6b813a491af42a5f46d8;p=clang Tests for DR381-388. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203549 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/drs/dr3xx.cpp b/test/CXX/drs/dr3xx.cpp index 2d07ea3bc1..eeec7832d0 100644 --- a/test/CXX/drs/dr3xx.cpp +++ b/test/CXX/drs/dr3xx.cpp @@ -924,3 +924,105 @@ namespace dr377 { // dr377: yes // dr378: dup 276 // dr379: na + +namespace dr381 { // dr381: yes + struct A { + int a; + }; + struct B : virtual A {}; + struct C : B {}; + struct D : B {}; + struct E : public C, public D {}; + struct F : public A {}; + void f() { + E e; + e.B::a = 0; // expected-error {{ambiguous conversion}} + F f; + f.A::a = 1; + } +} + +namespace dr382 { // dr382: yes c++11 + // FIXME: Should we allow this in C++98 mode? + struct A { typedef int T; }; + typename A::T t; + typename dr382::A a; +#if __cplusplus < 201103L + // expected-error@-3 {{occurs outside of a template}} + // expected-error@-3 {{occurs outside of a template}} +#endif + typename A b; // expected-error {{expected a qualified name}} +} + +namespace dr383 { // dr383: yes + struct A { A &operator=(const A&); }; + struct B { ~B(); }; + union C { C &operator=(const C&); }; + union D { ~D(); }; + int check[(__is_pod(A) || __is_pod(B) || __is_pod(C) || __is_pod(D)) ? -1 : 1]; +} + +namespace dr384 { // dr384: yes + namespace N1 { + template struct Base {}; + template struct X { + struct Y : public Base { + Y operator+(int) const; + }; + Y f(unsigned i) { return Y() + i; } + }; + } + + namespace N2 { + struct Z {}; + template int *operator+(T, unsigned); + } + + int main() { + N1::X v; + v.f(0); + } +} + +namespace dr385 { // dr385: yes + struct A { protected: void f(); }; + struct B : A { using A::f; }; + struct C : A { void g(B b) { b.f(); } }; + void h(B b) { b.f(); } + + struct D { int n; }; // expected-note {{member}} + struct E : protected D {}; // expected-note 2{{protected}} + struct F : E { friend int i(E); }; + int i(E e) { return e.n; } // expected-error {{protected base}} expected-error {{protected member}} +} + +namespace dr387 { // dr387: yes + namespace old { + template class number { + number(int); // expected-note 2{{here}} + friend number gcd(number &x, number &y) {} + }; + + void g() { + number a(3), b(4); // expected-error 2{{private}} + a = gcd(a, b); + b = gcd(3, 4); // expected-error {{undeclared}} + } + } + + namespace newer { + template class number { + public: + number(int); + friend number gcd(number x, number y) { return 0; } + }; + + void g() { + number a(3), b(4); + a = gcd(a, b); + b = gcd(3, 4); // expected-error {{undeclared}} + } + } +} + +// FIXME: dr388 needs codegen test diff --git a/www/cxx_dr_status.html b/www/cxx_dr_status.html index 89546db67c..c4420b9414 100644 --- a/www/cxx_dr_status.html +++ b/www/cxx_dr_status.html @@ -1137,7 +1137,7 @@ 183 TC1 typename in explicit specializations - Superseded by 382 + Superseded by 382 184 @@ -2327,31 +2327,31 @@ of class templates 381 CD1 Incorrect example of base class member lookup - Unknown + Yes 382 CD1 Allow typename outside of templates - Unknown + Yes (C++11 onwards) 383 CD1 Is a class with a declared but not defined destructor a POD? - Unknown + Yes 384 NAD Argument-dependent lookup and operator functions - Unknown + Yes 385 CD1 How does protected member check of 11.5 interact with using-declarations? - Unknown + Yes 386 @@ -2363,7 +2363,7 @@ of class templates 387 CD1 Errors in example in 14.6.5 - Unknown + Yes 388