Tests for core issues 224-240.

llvm-svn: 194946
This commit is contained in:
Richard Smith 2013-11-17 02:50:30 +00:00
parent 64283bd99c
commit 7101fd0e56
2 changed files with 202 additions and 14 deletions

View File

@ -217,3 +217,191 @@ namespace dr221 { // dr221: yes
// apparently both voted into the WP and acted upon by the editor.
// dr223: na
namespace dr224 { // dr224: no
namespace example1 {
template <class T> class A {
typedef int type;
A::type a;
A<T>::type b;
A<T*>::type c; // expected-error {{missing 'typename'}}
::dr224::example1::A<T>::type d;
class B {
typedef int type;
A::type a;
A<T>::type b;
A<T*>::type c; // expected-error {{missing 'typename'}}
::dr224::example1::A<T>::type d;
B::type e;
A<T>::B::type f;
A<T*>::B::type g; // expected-error {{missing 'typename'}}
typename A<T*>::B::type h;
};
};
template <class T> class A<T*> {
typedef int type;
A<T*>::type a;
A<T>::type b; // expected-error {{missing 'typename'}}
};
template <class T1, class T2, int I> struct B {
typedef int type;
B<T1, T2, I>::type b1;
B<T2, T1, I>::type b2; // expected-error {{missing 'typename'}}
typedef T1 my_T1;
static const int my_I = I;
static const int my_I2 = I+0;
static const int my_I3 = my_I;
B<my_T1, T2, my_I>::type b3; // FIXME: expected-error {{missing 'typename'}}
B<my_T1, T2, my_I2>::type b4; // expected-error {{missing 'typename'}}
B<my_T1, T2, my_I3>::type b5; // FIXME: expected-error {{missing 'typename'}}
};
}
namespace example2 {
template <int, typename T> struct X { typedef T type; };
template <class T> class A {
static const int i = 5;
X<i, int>::type w; // FIXME: expected-error {{missing 'typename'}}
X<A::i, char>::type x; // FIXME: expected-error {{missing 'typename'}}
X<A<T>::i, double>::type y; // FIXME: expected-error {{missing 'typename'}}
X<A<T*>::i, long>::type z; // expected-error {{missing 'typename'}}
int f();
};
template <class T> int A<T>::f() {
return i;
}
}
}
// dr225: yes
template<typename T> void dr225_f(T t) { dr225_g(t); } // expected-error {{call to function 'dr225_g' that is neither visible in the template definition nor found by argument-dependent lookup}}
void dr225_g(int); // expected-note {{should be declared prior to the call site}}
template void dr225_f(int); // expected-note {{in instantiation of}}
namespace dr226 { // dr226: no
template<typename T = void> void f() {}
#if __cplusplus < 201103L
// expected-error@-2 {{extension}}
// FIXME: This appears to be wrong: default arguments for function templates
// are listed as a defect (in c++98) not an extension. EDG accepts them in
// strict c++98 mode.
#endif
template<typename T> struct S {
template<typename U = void> void g();
#if __cplusplus < 201103L
// expected-error@-2 {{extension}}
#endif
template<typename U> struct X;
template<typename U> void h();
};
template<typename T> template<typename U> void S<T>::g() {}
template<typename T> template<typename U = void> struct S<T>::X {}; // expected-error {{cannot add a default template arg}}
template<typename T> template<typename U = void> void S<T>::h() {} // expected-error {{cannot add a default template arg}}
template<typename> void friend_h();
struct A {
// FIXME: This is ill-formed.
template<typename=void> struct friend_B;
// FIXME: f, h, and i are ill-formed.
// f is ill-formed because it is not a definition.
// h and i are ill-formed because they are not the only declarations of the
// function in the translation unit.
template<typename=void> void friend_f();
template<typename=void> void friend_g() {}
template<typename=void> void friend_h() {}
template<typename=void> void friend_i() {}
#if __cplusplus < 201103L
// expected-error@-5 {{extension}} expected-error@-4 {{extension}}
// expected-error@-4 {{extension}} expected-error@-3 {{extension}}
#endif
};
template<typename> void friend_i();
template<typename=void, typename X> void foo(X) {}
template<typename=void, typename X> struct Foo {}; // expected-error {{missing a default argument}} expected-note {{here}}
#if __cplusplus < 201103L
// expected-error@-3 {{extension}}
#endif
template<typename=void, typename X, typename, typename Y> int foo(X, Y);
template<typename, typename X, typename=void, typename Y> int foo(X, Y);
int x = foo(0, 0);
#if __cplusplus < 201103L
// expected-error@-4 {{extension}}
// expected-error@-4 {{extension}}
#endif
}
void dr227(bool b) { // dr227: yes
if (b)
int n;
else
int n;
}
namespace dr228 { // dr228: yes
template <class T> struct X {
void f();
};
template <class T> struct Y {
void g(X<T> x) { x.template X<T>::f(); }
};
}
namespace dr229 { // dr229: yes
template<typename T> void f();
template<typename T> void f<T*>() {} // expected-error {{function template partial specialization}}
template<> void f<int>() {}
}
namespace dr231 { // dr231: yes
namespace outer {
namespace inner {
int i; // expected-note {{here}}
}
void f() { using namespace inner; }
int j = i; // expected-error {{undeclared identifier 'i'; did you mean 'inner::i'?}}
}
}
// dr234: na
// dr235: na
namespace dr236 { // dr236: yes
void *p = int();
#if __cplusplus < 201103L
// expected-warning@-2 {{null pointer}}
#else
// expected-error@-4 {{cannot initialize}}
#endif
}
namespace dr237 { // dr237: dup 470
template<typename T> struct A { void f() { T::error; } };
template<typename T> struct B : A<T> {};
template struct B<int>; // ok
}
namespace dr239 { // dr239: yes
namespace NS {
class T {};
void f(T);
float &g(T, int);
}
NS::T parm;
int &g(NS::T, float);
int main() {
f(parm);
float &r = g(parm, 1);
extern int &g(NS::T, float);
int &s = g(parm, 1);
}
}
// dr240: dup 616

View File

@ -110,7 +110,7 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#12">12</a></td>
<td>dup</td>
<td>Default arguments on different declarations for the same function and the Koenig lookup</td>
<td class="none" align="center">Superseded by 239</td>
<td class="full" align="center">Superseded by 239</td>
</tr>
<tr class="open">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#13">13</a></td>
@ -1383,37 +1383,37 @@ accessible?</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#224">224</a></td>
<td>CD1</td>
<td>Definition of dependent names</td>
<td class="none" align="center">Unknown</td>
<td class="none" align="center">No</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#225">225</a></td>
<td>NAD</td>
<td>Koenig lookup and fundamental 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#226">226</a></td>
<td>CD1</td>
<td>Default template arguments for function templates</td>
<td class="none" align="center">Unknown</td>
<td class="none" align="center">No</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#227">227</a></td>
<td>TC1</td>
<td>How many scopes in an <TT>if</TT> statement?</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#228">228</a></td>
<td>CD1</td>
<td>Use of <TT>template</TT> keyword with non-member 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_closed.html#229">229</a></td>
<td>NAD</td>
<td>Partial specialization of function templates</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_closed.html#230">230</a></td>
@ -1425,7 +1425,7 @@ accessible?</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#231">231</a></td>
<td>NAD</td>
<td>Visibility of names after <I>using-directive</I>s</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#232">232</a></td>
@ -1443,25 +1443,25 @@ accessible?</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#234">234</a></td>
<td>NAD</td>
<td>Reuse of base class subobjects</td>
<td class="none" align="center">Unknown</td>
<td class="na" align="center">N/A</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#235">235</a></td>
<td>TC1</td>
<td>Assignment vs initialization</td>
<td class="none" align="center">Unknown</td>
<td class="na" align="center">N/A</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#236">236</a></td>
<td>NAD</td>
<td>Explicit temporaries and integral constant expressions</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#237">237</a></td>
<td>CD1</td>
<td>Explicit instantiation and base class members</td>
<td class="none" align="center">Unknown</td>
<td class="none" align="center">Duplicate of 470</td>
</tr>
<tr class="open">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#238">238</a></td>
@ -1473,13 +1473,13 @@ accessible?</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#239">239</a></td>
<td>CD1</td>
<td>Footnote 116 and Koenig lookup</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#240">240</a></td>
<td>DRWP</td>
<td>Uninitialized values and undefined behavior</td>
<td class="none" align="center">Unknown</td>
<td class="none" align="center">Duplicate of 616</td>
</tr>
<tr>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#241">241</a></td>