Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 2 | // 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= |
| 3 | // 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="}" |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 4 | |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 5 | BEGIN |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 6 | template<typename T> struct A; |
| 7 | template<typename T> struct B; |
| 8 | template<typename T> struct C; |
| 9 | template<typename T = int> struct D; |
Richard Smith | e7bd6de | 2015-06-10 20:30:23 +0000 | [diff] [blame] | 10 | template<typename T = int> struct E {}; |
Richard Smith | 35c1df5 | 2015-06-17 20:16:32 +0000 | [diff] [blame] | 11 | template<typename T> struct H {}; |
Richard Smith | afe800c | 2015-06-17 22:13:23 +0000 | [diff] [blame] | 12 | template<typename T = int, typename U = int> struct I {}; |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 13 | END |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 14 | |
| 15 | #include "b.h" |
Richard Smith | 535ff80 | 2015-09-11 22:39:35 +0000 | [diff] [blame] | 16 | #include "d.h" |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 17 | |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 18 | BEGIN |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 19 | template<typename T = int> struct A {}; |
| 20 | template<typename T> struct B {}; |
| 21 | template<typename T = int> struct B; |
| 22 | template<typename T = int> struct C; |
| 23 | template<typename T> struct D {}; |
Richard Smith | e7bd6de | 2015-06-10 20:30:23 +0000 | [diff] [blame] | 24 | template<typename T> struct F {}; |
Richard Smith | 35c1df5 | 2015-06-17 20:16:32 +0000 | [diff] [blame] | 25 | template<typename T> struct G {}; |
Richard Smith | 6dc8ae1 | 2015-08-17 20:24:17 +0000 | [diff] [blame] | 26 | template<typename T> struct J {}; |
| 27 | template<typename T = int> struct J; |
| 28 | struct K : J<> {}; |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 29 | END |
Richard Smith | e7bd6de | 2015-06-10 20:30:23 +0000 | [diff] [blame] | 30 | |
| 31 | #include "c.h" |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 32 | |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 33 | BEGIN |
Richard Smith | 87bb569 | 2015-06-09 00:35:49 +0000 | [diff] [blame] | 34 | A<> a; |
| 35 | B<> b; |
| 36 | extern C<> c; |
| 37 | D<> d; |
Richard Smith | e7bd6de | 2015-06-10 20:30:23 +0000 | [diff] [blame] | 38 | E<> e; |
| 39 | F<> f; |
Richard Smith | 35c1df5 | 2015-06-17 20:16:32 +0000 | [diff] [blame] | 40 | G<> g; // expected-error {{default argument of 'G' must be imported from module 'X.A' before it is required}} |
Richard Smith | 35c1df5 | 2015-06-17 20:16:32 +0000 | [diff] [blame] | 41 | // expected-note@a.h:7 {{default argument declared here}} |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 42 | H<> h; // expected-error {{default argument of 'H' must be imported from module 'X.A' before it is required}} |
| 43 | // expected-note@a.h:8 {{default argument declared here}} |
Richard Smith | afe800c | 2015-06-17 22:13:23 +0000 | [diff] [blame] | 44 | I<> i; |
Richard Smith | 535ff80 | 2015-09-11 22:39:35 +0000 | [diff] [blame] | 45 | L<> *l; |
Richard Smith | 4440d6e | 2015-07-19 23:44:27 +0000 | [diff] [blame] | 46 | END |
Richard Smith | 2195ec9 | 2017-04-21 01:15:13 +0000 | [diff] [blame^] | 47 | |
| 48 | namespace DeferredLookup { |
| 49 | template<typename T, typename U = T> using X = U; |
| 50 | template<typename T> void f() { (void) X<T>(); } |
| 51 | template<typename T> int n = X<T>(); // expected-warning {{extension}} |
| 52 | template<typename T> struct S { X<T> xt; enum E : int; }; |
| 53 | template<typename T> enum S<T>::E : int { a = X<T>() }; |
| 54 | |
| 55 | void test() { |
| 56 | f<int>(); |
| 57 | n<int> = 1; |
| 58 | S<int> s; |
| 59 | S<int>::E e = S<int>::E::a; |
| 60 | |
| 61 | Indirect::B<int>::C<int> indirect; |
| 62 | } |
| 63 | } |