[PATCH] Sema: Subst type default template args earlier
Richard Smith
richard at metafoo.co.uk
Tue Aug 27 17:03:20 PDT 2013
Can you add a friend template test case too? Something like this one (-std=c++1y):
template<typename U> struct A {
template<typename T = U> friend auto f(A) { return []{}; }
};
template<typename T> void f();
using T = decltype(f(A<int>()));
using T = decltype(f<int>(A<int>()));
Maybe also add this test from core issue 1635:
template<class T>
struct X {
template<class U = typename T::type>
static void foo(int){}
static void foo(...){}
};
int main(){
X<int>::foo(0);
}
================
Comment at: test/CodeGenCXX/mangle.cpp:914-915
@@ +913,3 @@
+
+namespace test41 {
+}
----------------
Hm?
================
Comment at: test/SemaTemplate/default-arguments.cpp:49-70
@@ -48,22 +48,24 @@
template<typename T>
struct X2 {
- template<typename U = typename X1<T>::type> // expected-error{{no type named}}
- struct Inner1 { };
+ template<typename U = typename X1<T>::type> // expected-error{{no type named 'type' in 'X1<int>'}} \
+ // expected-error{{no type named 'type' in 'X1<char>'}}
+ struct Inner1 { }; // expected-note{{template is declared here}}
- template<T Value = X1<T>::value> // expected-error{{no member named 'value'}}
- struct NonType1 { };
+ template<T Value = X1<T>::value> // expected-error{{no member named 'value' in 'X1<int>'}} \
+ // expected-error{{no member named 'value' in 'X1<char>'}}
+ struct NonType1 { }; // expected-note{{template is declared here}}
template<T Value>
struct Inner2 { };
template<typename U>
struct Inner3 {
template<typename X = T, typename V = U>
struct VeryInner { };
template<T Value1 = sizeof(T), T Value2 = sizeof(U),
T Value3 = Value1 + Value2>
struct NonType2 { };
};
};
----------------
Please also add a test for template template parameters.
http://llvm-reviews.chandlerc.com/D1507
More information about the cfe-commits
mailing list