Skip to content

Commit 786d8a2

Browse files
committed
Tests for CWG issue 165-170.
llvm-svn: 194215
1 parent f48b5ab commit 786d8a2

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

clang/test/CXX/drs/dr1xx.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,57 @@ namespace dr165 { // dr165: no
670670
// FIXME: dr165 says this is ill-formed, but the argument in dr1477 says it's ok
671671
void N::g() {}
672672
}
673+
674+
namespace dr166 { // dr166: yes
675+
namespace A { class X; }
676+
677+
template<typename T> int f(T t) { return t.n; }
678+
int g(A::X);
679+
template<typename T> int h(T t) { return t.n; } // expected-error {{private}}
680+
int i(A::X);
681+
682+
namespace A {
683+
class X {
684+
friend int f<X>(X);
685+
friend int dr166::g(X);
686+
friend int h(X);
687+
friend int i(X);
688+
int n; // expected-note 2{{here}}
689+
};
690+
691+
int h(X x) { return x.n; }
692+
int i(X x) { return x.n; }
693+
}
694+
695+
template int f(A::X);
696+
int g(A::X x) { return x.n; }
697+
template int h(A::X); // expected-note {{instantiation}}
698+
int i(A::X x) { return x.n; } // expected-error {{private}}
699+
}
700+
701+
// dr167: sup 1012
702+
703+
namespace dr168 { // dr168: no
704+
extern "C" typedef int (*p)();
705+
extern "C++" typedef int (*q)();
706+
struct S {
707+
static int f();
708+
};
709+
p a = &S::f; // FIXME: this should fail.
710+
q b = &S::f;
711+
}
712+
713+
namespace dr169 { // dr169: yes
714+
template<typename> struct A { int n; };
715+
struct B {
716+
template<typename> struct C;
717+
template<typename> void f();
718+
template<typename> static int n; // expected-error 0-1{{extension}}
719+
};
720+
struct D : A<int>, B {
721+
using A<int>::n;
722+
using B::C<int>; // expected-error {{using declaration can not refer to a template specialization}}
723+
using B::f<int>; // expected-error {{using declaration can not refer to a template specialization}}
724+
using B::n<int>; // expected-error {{using declaration can not refer to a template specialization}}
725+
};
726+
}

clang/www/cxx_dr_status.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,25 +1034,25 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
10341034
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#166">166</a></td>
10351035
<td>TC1</td>
10361036
<td>Friend declarations of <I>template-id</I>s</td>
1037-
<td class="none" align="center">Unknown</td>
1037+
<td class="full" align="center">Yes</td>
10381038
</tr>
10391039
<tr>
10401040
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#167">167</a></td>
10411041
<td>NAD</td>
10421042
<td>Deprecating static functions</td>
1043-
<td class="none" align="center">Unknown</td>
1043+
<td class="none" align="center">Superseded by 1012</td>
10441044
</tr>
10451045
<tr>
10461046
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#168">168</a></td>
10471047
<td>NAD</td>
10481048
<td>C linkage for static member functions</td>
1049-
<td class="none" align="center">Unknown</td>
1049+
<td class="none" align="center">No</td>
10501050
</tr>
10511051
<tr>
10521052
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#169">169</a></td>
10531053
<td>NAD</td>
10541054
<td><I>template-id</I>s in <I>using-declaration</I>s</td>
1055-
<td class="none" align="center">Unknown</td>
1055+
<td class="full" align="center">Yes</td>
10561056
</tr>
10571057
<tr class="open">
10581058
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#170">170</a></td>

0 commit comments

Comments
 (0)