r194240 - Tests for core issue 170-200.
Richard Smith
richard-llvm at metafoo.co.uk
Thu Nov 7 18:05:54 PST 2013
Author: rsmith
Date: Thu Nov 7 20:05:54 2013
New Revision: 194240
URL: http://llvm.org/viewvc/llvm-project?rev=194240&view=rev
Log:
Tests for core issue 170-200.
Added:
cfe/trunk/test/CXX/drs/dr2xx.cpp
Modified:
cfe/trunk/test/CXX/drs/dr1xx.cpp
cfe/trunk/www/cxx_dr_status.html
Modified: cfe/trunk/test/CXX/drs/dr1xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr1xx.cpp?rev=194240&r1=194239&r2=194240&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr1xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr1xx.cpp Thu Nov 7 20:05:54 2013
@@ -724,3 +724,288 @@ namespace dr169 { // dr169: yes
using B::n<int>; // expected-error {{using declaration can not refer to a template specialization}}
};
}
+
+namespace { // dr171: yes
+ int dr171a;
+}
+int dr171b; // expected-note {{here}}
+namespace dr171 {
+ extern "C" void dr171a();
+ extern "C" void dr171b(); // expected-error {{conflicts}}
+}
+
+namespace dr172 { // dr172: yes
+ enum { zero };
+ int check1[-1 < zero ? 1 : -1];
+
+ enum { x = -1, y = (unsigned int)-1 };
+ int check2[sizeof(x) > sizeof(int) ? 1 : -1];
+
+ enum { a = (unsigned int)-1 / 2 };
+ int check3a[sizeof(a) == sizeof(int) ? 1 : -1];
+ int check3b[-a < 0 ? 1 : -1];
+
+ enum { b = (unsigned int)-1 / 2 + 1 };
+ int check4a[sizeof(b) == sizeof(unsigned int) ? 1 : -1];
+ int check4b[-b > 0 ? 1 : -1];
+
+ enum { c = (unsigned long)-1 / 2 };
+ int check5a[sizeof(c) == sizeof(long) ? 1 : -1];
+ int check5b[-c < 0 ? 1 : -1];
+
+ enum { d = (unsigned long)-1 / 2 + 1 };
+ int check6a[sizeof(d) == sizeof(unsigned long) ? 1 : -1];
+ int check6b[-d > 0 ? 1 : -1];
+
+ enum { e = (unsigned long long)-1 / 2 }; // expected-error 0-1{{extension}}
+ int check7a[sizeof(e) == sizeof(long) ? 1 : -1]; // expected-error 0-1{{extension}}
+ int check7b[-e < 0 ? 1 : -1];
+
+ enum { f = (unsigned long long)-1 / 2 + 1 }; // expected-error 0-1{{extension}}
+ int check8a[sizeof(f) == sizeof(unsigned long) ? 1 : -1]; // expected-error 0-1{{extension}}
+ int check8b[-f > 0 ? 1 : -1];
+}
+
+namespace dr173 { // dr173: yes
+ int check[('0' + 1 == '1' && '0' + 2 == '2' && '0' + 3 == '3' &&
+ '0' + 4 == '4' && '0' + 5 == '5' && '0' + 6 == '6' &&
+ '0' + 7 == '7' && '0' + 8 == '8' && '0' + 9 == '9') ? 1 : -1];
+}
+
+// dr174: sup 1012
+
+namespace dr175 { // dr175: yes
+ struct A {}; // expected-note {{here}}
+ struct B : private A {}; // expected-note {{constrained by private inheritance}}
+ struct C : B {
+ A a; // expected-error {{private}}
+ dr175::A b;
+ };
+}
+
+namespace dr176 { // dr176: yes
+ template<typename T> class Y;
+ template<> class Y<int> {
+ void f() {
+ typedef Y A; // expected-note {{here}}
+ typedef Y<char> A; // expected-error {{different types ('Y<char>' vs 'Y<int>')}}
+ }
+ };
+
+ template<typename T> struct Base {}; // expected-note 2{{found}}
+ template<typename T> struct Derived : public Base<T> {
+ void f() {
+ typedef typename Derived::template Base<T> A;
+ typedef typename Derived::Base A;
+ }
+ };
+ template struct Derived<int>;
+
+ template<typename T> struct Derived2 : Base<int>, Base<char> {
+ typename Derived2::Base b; // expected-error {{found in multiple base classes}}
+ typename Derived2::Base<double> d;
+ };
+
+ template<typename T> class X { // expected-note {{here}}
+ X *p1;
+ X<T> *p2;
+ X<int> *p3;
+ dr176::X *p4; // expected-error {{requires template arguments}}
+ };
+}
+
+namespace dr177 { // dr177: yes
+ struct B {};
+ struct A {
+ A(A &); // expected-note {{not viable: expects an l-value}}
+ A(const B &);
+ };
+ B b;
+ A a = b; // expected-error {{no viable constructor copying variable}}
+}
+
+namespace dr178 { // dr178: yes
+ int check[int() == 0 ? 1 : -1];
+#if __cplusplus >= 201103L
+ static_assert(int{} == 0, "");
+ struct S { int a, b; };
+ static_assert(S{1}.b == 0, "");
+ struct T { constexpr T() : n() {} int n; };
+ static_assert(T().n == 0, "");
+ struct U : S { constexpr U() : S() {} };
+ static_assert(U().b == 0, "");
+#endif
+}
+
+namespace dr179 { // dr179: yes
+ void f();
+ int n = &f - &f; // expected-error {{arithmetic on pointers to the function type 'void ()'}}
+}
+
+namespace dr180 { // dr180: yes
+ template<typename T> struct X : T, T::some_base {
+ X() : T::some_type_that_might_be_T(), T::some_base() {}
+ friend class T::some_class;
+ void f() {
+ enum T::some_enum e;
+ }
+ };
+}
+
+namespace dr181 { // dr181: yes
+ namespace X {
+ template <template X<class T> > struct A { }; // expected-error +{{}}
+ template <template X<class T> > void f(A<X>) { } // expected-error +{{}}
+ }
+
+ namespace Y {
+ template <template <class T> class X> struct A { };
+ template <template <class T> class X> void f(A<X>) { }
+ }
+}
+
+namespace dr182 { // dr182: yes
+ template <class T> struct C {
+ void f();
+ void g();
+ };
+
+ template <class T> void C<T>::f() {}
+ template <class T> void C<T>::g() {}
+
+ class A {
+ class B {}; // expected-note {{here}}
+ void f();
+ };
+
+ template void C<A::B>::f();
+ template <> void C<A::B>::g(); // expected-error {{private}}
+
+ void A::f() {
+ C<B> cb;
+ cb.f();
+ }
+}
+
+namespace dr183 { // dr183: sup 382
+ template<typename T> struct A {};
+ template<typename T> struct B {
+ typedef int X;
+ };
+ template<> struct A<int> {
+ typename B<int>::X x;
+ };
+}
+
+namespace dr184 { // dr184: yes
+ template<typename T = float> struct B {};
+
+ template<template<typename TT = float> class T> struct A {
+ void f();
+ void g();
+ };
+
+ template<template<typename TT> class T> void A<T>::f() { // expected-note {{here}}
+ T<> t; // expected-error {{too few template arguments}}
+ }
+
+ template<template<typename TT = char> class T> void A<T>::g() {
+ T<> t;
+ typedef T<> X;
+ typedef T<char> X;
+ }
+
+ void h() { A<B>().g(); }
+}
+
+// dr185 FIXME: add codegen test
+
+namespace dr187 { // dr187: sup 481
+ const int Z = 1;
+ template<int X = Z, int Z = X> struct A;
+ typedef A<> T;
+ typedef A<1, 1> T;
+}
+
+namespace dr188 { // dr188: yes
+ char c[10];
+ int check[sizeof(0, c) == 10 ? 1 : -1];
+}
+
+// dr190 FIXME: add codegen test for tbaa
+
+// dr193 FIXME: add codegen test
+
+namespace dr194 { // dr194: yes
+ struct A {
+ A();
+ void A(); // expected-error {{has the same name as its class}} expected-error {{constructor cannot have a return type}}
+ };
+ struct B {
+ void B(); // expected-error {{has the same name as its class}} expected-error {{constructor cannot have a return type}}
+ B();
+ };
+ struct C {
+ inline explicit C(int) {}
+ };
+}
+
+namespace dr195 { // dr195: yes
+ void f();
+ int *p = (int*)&f; // expected-error 0-1{{extension}}
+ void (*q)() = (void(*)())&p; // expected-error 0-1{{extension}}
+}
+
+namespace dr197 { // dr197: yes
+ char &f(char);
+
+ template <class T> void g(T t) {
+ char &a = f(1);
+ char &b = f(T(1)); // expected-error {{unrelated type 'int'}}
+ char &c = f(t); // expected-error {{unrelated type 'int'}}
+ }
+
+ void f(int);
+
+ enum E { e };
+ int &f(E);
+
+ void h() {
+ g('a');
+ g(2);
+ g(e); // expected-note {{in instantiation of}}
+ }
+}
+
+namespace dr198 { // dr198: yes
+ struct A {
+ int n;
+ struct B {
+ int m[sizeof(n)];
+#if __cplusplus < 201103L
+ // expected-error at -2 {{invalid use of non-static data member}}
+#endif
+ int f() { return n; }
+ // expected-error at -1 {{use of non-static data member 'n' of 'A' from nested type 'B'}}
+ };
+ struct C;
+ struct D;
+ };
+ struct A::C {
+ int m[sizeof(n)];
+#if __cplusplus < 201103L
+ // expected-error at -2 {{invalid use of non-static data member}}
+#endif
+ int f() { return n; }
+ // expected-error at -1 {{use of non-static data member 'n' of 'A' from nested type 'C'}}
+ };
+ struct A::D : A {
+ int m[sizeof(n)];
+#if __cplusplus < 201103L
+ // expected-error at -2 {{invalid use of non-static data member}}
+#endif
+ int f() { return n; }
+ };
+}
+
+// dr199 FIXME: add codegen test
Added: cfe/trunk/test/CXX/drs/dr2xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr2xx.cpp?rev=194240&view=auto
==============================================================================
--- cfe/trunk/test/CXX/drs/dr2xx.cpp (added)
+++ cfe/trunk/test/CXX/drs/dr2xx.cpp Thu Nov 7 20:05:54 2013
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// 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
+
+namespace dr200 { // dr200: dup 214
+ template <class T> T f(int);
+ template <class T, class U> T f(U) = delete; // expected-error 0-1{{extension}}
+
+ void g() {
+ f<int>(1);
+ }
+}
Modified: cfe/trunk/www/cxx_dr_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=194240&r1=194239&r2=194240&view=diff
==============================================================================
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Thu Nov 7 20:05:54 2013
@@ -248,7 +248,7 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#35">35</a></td>
<td>TC1</td>
<td>Definition of default-initialization</td>
- <td class="none" align="center">Duplicate of 178</td>
+ <td class="full" align="center">Duplicate of 178</td>
</tr>
<tr class="open">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#36">36</a></td>
@@ -1064,85 +1064,85 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#171">171</a></td>
<td>TC1</td>
<td>Global namespace scope</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#172">172</a></td>
<td>CD1</td>
<td>Unsigned int as underlying type of enum</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#173">173</a></td>
<td>TC1</td>
<td>Constraints on execution character set</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#174">174</a></td>
<td>NAD</td>
<td>Undeprecating global static</td>
- <td class="none" align="center">Unknown</td>
+ <td class="none" align="center">Superseded by 1012</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#175">175</a></td>
<td>CD1</td>
<td>Class name injection and base name access</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#176">176</a></td>
<td>TC1</td>
<td>Name injection and templates</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#177">177</a></td>
<td>CD1</td>
<td>Lvalues vs rvalues in copy-initialization</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#178">178</a></td>
<td>TC1</td>
<td>More on value-initialization</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#179">179</a></td>
<td>TC1</td>
<td>Function pointers and subtraction</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#180">180</a></td>
<td>CD1</td>
<td><TT>typename</TT> and elaborated types</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#181">181</a></td>
<td>TC1</td>
<td>Errors in template <I>template-parameter</I> example</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#182">182</a></td>
<td>NAD</td>
<td>Access checking on explicit specializations</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#183">183</a></td>
<td>TC1</td>
<td><TT>typename</TT> in explicit specializations</td>
- <td class="none" align="center">Unknown</td>
+ <td class="none" align="center">Superseded by 382</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#184">184</a></td>
<td>CD1</td>
<td>Default arguments in template <I>template-parameter</I>s</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#185">185</a></td>
@@ -1160,13 +1160,13 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#187">187</a></td>
<td>TC1</td>
<td>Scope of template parameter names</td>
- <td class="none" align="center">Unknown</td>
+ <td class="none" align="center">Superseded by 481</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#188">188</a></td>
<td>TC1</td>
<td>Comma operator and rvalue conversion</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr class="open">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#189">189</a></td>
@@ -1202,13 +1202,13 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#194">194</a></td>
<td>TC1</td>
<td>Identifying constructors</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195">195</a></td>
<td>CD1</td>
<td>Converting between function and object pointers</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr class="open">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#196">196</a></td>
@@ -1220,13 +1220,13 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#197">197</a></td>
<td>CD1</td>
<td>Issues with two-stage lookup of dependent names</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#198">198</a></td>
<td>CD1</td>
<td>Definition of "use" in local and nested classes</td>
- <td class="none" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#199">199</a></td>
@@ -1238,7 +1238,7 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#200">200</a></td>
<td>dup</td>
<td>Partial ordering and explicit arguments</td>
- <td class="none" align="center">Unknown</td>
+ <td class="none" align="center">Duplicate of 214</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#201">201</a></td>
More information about the cfe-commits
mailing list