2015-06-09 08:35:49 +08:00
|
|
|
// RUN: rm -rf %t
|
2015-07-20 07:44:27 +08:00
|
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -fno-modules-error-recovery -I %S/Inputs/template-default-args -std=c++11 %s -DBEGIN= -DEND=
|
|
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -fno-modules-error-recovery -I %S/Inputs/template-default-args -std=c++11 %s -DBEGIN="namespace N {" -DEND="}"
|
2015-06-09 08:35:49 +08:00
|
|
|
|
2015-07-20 07:44:27 +08:00
|
|
|
BEGIN
|
2015-06-09 08:35:49 +08:00
|
|
|
template<typename T> struct A;
|
|
|
|
template<typename T> struct B;
|
|
|
|
template<typename T> struct C;
|
|
|
|
template<typename T = int> struct D;
|
2015-06-11 04:30:23 +08:00
|
|
|
template<typename T = int> struct E {};
|
2015-06-18 04:16:32 +08:00
|
|
|
template<typename T> struct H {};
|
2015-06-18 06:13:23 +08:00
|
|
|
template<typename T = int, typename U = int> struct I {};
|
2015-07-20 07:44:27 +08:00
|
|
|
END
|
2015-06-09 08:35:49 +08:00
|
|
|
|
|
|
|
#include "b.h"
|
2015-09-12 06:39:35 +08:00
|
|
|
#include "d.h"
|
2015-06-09 08:35:49 +08:00
|
|
|
|
2015-07-20 07:44:27 +08:00
|
|
|
BEGIN
|
2015-06-09 08:35:49 +08:00
|
|
|
template<typename T = int> struct A {};
|
|
|
|
template<typename T> struct B {};
|
|
|
|
template<typename T = int> struct B;
|
|
|
|
template<typename T = int> struct C;
|
|
|
|
template<typename T> struct D {};
|
2015-06-11 04:30:23 +08:00
|
|
|
template<typename T> struct F {};
|
2015-06-18 04:16:32 +08:00
|
|
|
template<typename T> struct G {};
|
2015-08-18 04:24:17 +08:00
|
|
|
template<typename T> struct J {};
|
|
|
|
template<typename T = int> struct J;
|
|
|
|
struct K : J<> {};
|
2015-07-20 07:44:27 +08:00
|
|
|
END
|
2015-06-11 04:30:23 +08:00
|
|
|
|
|
|
|
#include "c.h"
|
2015-06-09 08:35:49 +08:00
|
|
|
|
2015-07-20 07:44:27 +08:00
|
|
|
BEGIN
|
2015-06-09 08:35:49 +08:00
|
|
|
A<> a;
|
|
|
|
B<> b;
|
|
|
|
extern C<> c;
|
|
|
|
D<> d;
|
2015-06-11 04:30:23 +08:00
|
|
|
E<> e;
|
|
|
|
F<> f;
|
2020-04-29 09:22:34 +08:00
|
|
|
G<> g; // expected-error {{missing '#include "a.h"'; default argument of 'G' must be defined before it is used}}
|
|
|
|
// expected-note@a.h:7 {{default argument declared here is not reachable}}
|
|
|
|
H<> h; // expected-error {{missing '#include "a.h"'; default argument of 'H' must be defined before it is used}}
|
|
|
|
// expected-note@a.h:8 {{default argument declared here is not reachable}}
|
2015-06-18 06:13:23 +08:00
|
|
|
I<> i;
|
2015-09-12 06:39:35 +08:00
|
|
|
L<> *l;
|
2015-07-20 07:44:27 +08:00
|
|
|
END
|
2017-04-21 09:15:13 +08:00
|
|
|
|
|
|
|
namespace DeferredLookup {
|
|
|
|
template<typename T, typename U = T> using X = U;
|
|
|
|
template<typename T> void f() { (void) X<T>(); }
|
|
|
|
template<typename T> int n = X<T>(); // expected-warning {{extension}}
|
|
|
|
template<typename T> struct S { X<T> xt; enum E : int; };
|
|
|
|
template<typename T> enum S<T>::E : int { a = X<T>() };
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
f<int>();
|
|
|
|
n<int> = 1;
|
|
|
|
S<int> s;
|
|
|
|
S<int>::E e = S<int>::E::a;
|
|
|
|
|
|
|
|
Indirect::B<int>::C<int> indirect;
|
|
|
|
}
|
|
|
|
}
|