Tests for CWG issue 165-170.

llvm-svn: 194215
This commit is contained in:
Richard Smith 2013-11-07 19:26:14 +00:00
parent f48b5abc49
commit 786d8a26f2
2 changed files with 58 additions and 4 deletions

View File

@ -670,3 +670,57 @@ namespace dr165 { // dr165: no
// FIXME: dr165 says this is ill-formed, but the argument in dr1477 says it's ok
void N::g() {}
}
namespace dr166 { // dr166: yes
namespace A { class X; }
template<typename T> int f(T t) { return t.n; }
int g(A::X);
template<typename T> int h(T t) { return t.n; } // expected-error {{private}}
int i(A::X);
namespace A {
class X {
friend int f<X>(X);
friend int dr166::g(X);
friend int h(X);
friend int i(X);
int n; // expected-note 2{{here}}
};
int h(X x) { return x.n; }
int i(X x) { return x.n; }
}
template int f(A::X);
int g(A::X x) { return x.n; }
template int h(A::X); // expected-note {{instantiation}}
int i(A::X x) { return x.n; } // expected-error {{private}}
}
// dr167: sup 1012
namespace dr168 { // dr168: no
extern "C" typedef int (*p)();
extern "C++" typedef int (*q)();
struct S {
static int f();
};
p a = &S::f; // FIXME: this should fail.
q b = &S::f;
}
namespace dr169 { // dr169: yes
template<typename> struct A { int n; };
struct B {
template<typename> struct C;
template<typename> void f();
template<typename> static int n; // expected-error 0-1{{extension}}
};
struct D : A<int>, B {
using A<int>::n;
using B::C<int>; // expected-error {{using declaration can not refer to a template specialization}}
using B::f<int>; // expected-error {{using declaration can not refer to a template specialization}}
using B::n<int>; // expected-error {{using declaration can not refer to a template specialization}}
};
}

View File

@ -1034,25 +1034,25 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#166">166</a></td>
<td>TC1</td>
<td>Friend declarations of <I>template-id</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_closed.html#167">167</a></td>
<td>NAD</td>
<td>Deprecating static functions</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_closed.html#168">168</a></td>
<td>NAD</td>
<td>C linkage for static member functions</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#169">169</a></td>
<td>NAD</td>
<td><I>template-id</I>s in <I>using-declaration</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#170">170</a></td>