[CI] Detect step failures in metrics job (#122564)
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.explicit / p12.cpp
blob28903684df8f6bdf9a901144286dd76602240522
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 namespace test0 {
4 char* p = 0;
5 template<class T> T g(T x = &p) { return x; }
6 template int g<int>(int); // OK even though &p isn't an int.
9 // Don't impose access restrictions on explicit instantiations.
10 namespace test1 {
11 class A {
12 class Private {};
13 public:
14 typedef Private Public;
17 template <class T> class Temp {
18 static Temp<A::Public> make() { return Temp<A::Public>(); }
20 template class Temp<A::Private>;
22 // FIXME: this ought to be an error, but it isn't because Sema is
23 // silently failing to create a declaration for the explicit
24 // instantiation.
25 template class Temp<A::Private> Temp<int>::make();
28 // Don't impose access restrictions on explicit specializations,
29 // either. This goes here because it's an extension of the rule for
30 // explicit instantiations and doesn't have any independent support.
31 namespace test2 {
32 class A {
33 class Private {}; // expected-note {{implicitly declared private here}}
34 public:
35 typedef Private Public;
38 template <class T> class Temp {
39 static Temp<A::Public> make();
41 template <> class Temp<A::Private> {
42 public:
43 Temp(int x) {}
46 template <> class Temp<A::Private> Temp<int>::make() {
47 return Temp<A::Public>(0);
50 template <>
51 class Temp<char> {
52 static Temp<A::Private> make() { // expected-error {{is a private member}}
53 return Temp<A::Public>(0);