diff options
| -rw-r--r-- | clang/test/CXX/drs/dr5xx.cpp | 126 | ||||
| -rw-r--r-- | clang/www/cxx_dr_status.html | 16 |
2 files changed, 134 insertions, 8 deletions
diff --git a/clang/test/CXX/drs/dr5xx.cpp b/clang/test/CXX/drs/dr5xx.cpp index 8af639f7b50..770e32278fc 100644 --- a/clang/test/CXX/drs/dr5xx.cpp +++ b/clang/test/CXX/drs/dr5xx.cpp @@ -726,3 +726,129 @@ namespace dr572 { // dr572: yes enum E { a = 1, b = 2 }; int check[a + b == 3 ? 1 : -1]; } + +namespace dr573 { // dr573: no + void *a; + int *b = reinterpret_cast<int*>(a); + void (*c)() = reinterpret_cast<void(*)()>(a); + void *d = reinterpret_cast<void*>(c); +#if __cplusplus < 201103L + // expected-error@-3 {{extension}} + // expected-error@-3 {{extension}} +#endif + void f() { delete a; } // expected-error {{cannot delete}} + int n = d - a; // expected-error {{arithmetic on pointers to void}} + // FIXME: This is ill-formed. + template<void*> struct S; + template<int*> struct T; +} + +namespace dr574 { // dr574: yes + struct A { + A &operator=(const A&) const; // expected-note {{does not match because it is const}} + }; + struct B { + B &operator=(const B&) volatile; // expected-note {{nearly matches}} + }; +#if __cplusplus >= 201103L + struct C { + C &operator=(const C&) &; // expected-note {{not viable}} expected-note {{nearly matches}} expected-note {{here}} + }; + struct D { + D &operator=(const D&) &&; // expected-note {{not viable}} expected-note {{nearly matches}} expected-note {{here}} + }; + void test(C c, D d) { + c = c; + C() = c; // expected-error {{no viable}} + d = d; // expected-error {{no viable}} + D() = d; + } +#endif + struct Test { + friend A &A::operator=(const A&); // expected-error {{does not match}} + friend B &B::operator=(const B&); // expected-error {{does not match}} +#if __cplusplus >= 201103L + // FIXME: We shouldn't produce the 'cannot overload' diagnostics here. + friend C &C::operator=(const C&); // expected-error {{does not match}} expected-error {{cannot overload}} + friend D &D::operator=(const D&); // expected-error {{does not match}} expected-error {{cannot overload}} +#endif + }; +} + +namespace dr575 { // dr575: yes + template<typename T, typename U = typename T::type> void a(T); void a(...); // expected-error 0-1{{extension}} + template<typename T, typename T::type U = 0> void b(T); void b(...); // expected-error 0-1{{extension}} + template<typename T, int U = T::value> void c(T); void c(...); // expected-error 0-1{{extension}} + template<typename T> void d(T, int = T::value); void d(...); // expected-error {{cannot be used prior to '::'}} + void x() { + a(0); + b(0); + c(0); + d(0); // expected-note {{in instantiation of default function argument}} + } + + template<typename T = int&> void f(T* = 0); // expected-error 0-1{{extension}} + template<typename T = int> void f(T = 0); // expected-error 0-1{{extension}} + void g() { f<>(); } + + template<typename T> T &h(T *); + template<typename T> T *h(T *); + void *p = h((void*)0); +} + +namespace dr576 { // dr576: yes + typedef void f() {} // expected-error {{function definition is not allowed}} + void f(typedef int n); // expected-error {{invalid storage class}} + void f(char c) { typedef int n; } +} + +namespace dr577 { // dr577: yes + typedef void V; + typedef const void CV; + void a(void); + void b(const void); // expected-error {{qualifiers}} + void c(V); + void d(CV); // expected-error {{qualifiers}} + void (*e)(void) = c; + void (*f)(const void); // expected-error {{qualifiers}} + void (*g)(V) = a; + void (*h)(CV); // expected-error {{qualifiers}} + template<typename T> void i(T); // expected-note 2{{requires 1 arg}} + template<typename T> void j(void (*)(T)); // expected-note 2{{argument may not have 'void' type}} + void k() { + a(); + c(); + i<void>(); // expected-error {{no match}} + i<const void>(); // expected-error {{no match}} + j<void>(0); // expected-error {{no match}} + j<const void>(0); // expected-error {{no match}} + } +} + +namespace dr580 { // dr580: no + class C; + struct A { static C c; }; + struct B { static C c; }; + class C { + C(); // expected-note {{here}} + ~C(); // expected-note {{here}} + + typedef int I; // expected-note {{here}} + template<int> struct X; + template<int> friend struct Y; + template<int> void f(); + template<int> friend void g(); + friend struct A; + }; + + template<C::I> struct C::X {}; + template<C::I> struct Y {}; + template<C::I> struct Z {}; // FIXME: should reject, accepted because C befriends A! + + template<C::I> void C::f() {} + template<C::I> void g() {} + template<C::I> void h() {} // expected-error {{private}} + + C A::c; + C B::c; // expected-error 2{{private}} +} diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index dd20f5dd4b2..90b1420c153 100644 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -147,7 +147,7 @@ <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#18">18</a></td> <td>NAD</td> <td>f(TYPE) where TYPE is void should be allowed</td> - <td class="none" align="center">Superseded by <a href="#577">577</a></td> + <td class="full" align="center">Superseded by <a href="#577">577</a></td> </tr> <tr id="19"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#19">19</a></td> @@ -2033,7 +2033,7 @@ of class templates</td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#332">332</a></td> <td>CD3</td> <td>cv-qualified <TT>void</TT> parameter types</td> - <td class="none" align="center">Duplicate of <a href="#577">577</a></td> + <td class="full" align="center">Duplicate of <a href="#577">577</a></td> </tr> <tr id="333"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#333">333</a></td> @@ -3481,31 +3481,31 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#573">573</a></td> <td>C++11</td> <td>Conversions between function pointers and <TT>void*</TT></td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="574"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#574">574</a></td> <td>NAD</td> <td>Definition of “copy assignment operator”</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="575"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#575">575</a></td> <td>C++11</td> <td>Criteria for deduction failure</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="576"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#576">576</a></td> <td>CD2</td> <td>Typedefs in function definitions</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="577"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#577">577</a></td> <td>CD3</td> <td><TT>void</TT> in an empty parameter list</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr class="open" id="578"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#578">578</a></td> @@ -3523,7 +3523,7 @@ and <I>POD class</I></td> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#580">580</a></td> <td>C++11</td> <td>Access in <I>template-parameter</I>s of member and friend definitions</td> - <td class="none" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr class="open" id="581"> <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#581">581</a></td> |

