Now that we have declared/defined tag types within DeclGroups,
instantiation of tags local to member functions of class templates
(and, eventually, function templates) works when the tag is defined as
part of the decl-specifier-seq, e.g.,
struct S { T x, y; } s1;
Also, make sure that we don't try to default-initialize a dependent
type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72568 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/instantiate-declref.cpp b/test/SemaTemplate/instantiate-declref.cpp
index e49d330..590f241 100644
--- a/test/SemaTemplate/instantiate-declref.cpp
+++ b/test/SemaTemplate/instantiate-declref.cpp
@@ -40,13 +40,20 @@
namespace N2 {
struct Outer2 {
- template<typename T>
+ template<typename T, typename U = T>
struct Inner {
void foo() {
enum { K1Val = sizeof(T) } k1;
- enum K2 { K2Val = sizeof(T)*2 };
+ enum K2 { K2Val = sizeof(T)*2 } k2a;
- K2 k2 = K2Val;
+ K2 k2b = K2Val;
+
+ struct S { T x, y; } s1;
+ struct { U x, y; } s2;
+ s1.x = s2.x; // expected-error{{incompatible}}
+
+ typedef T type;
+ type t2 = s1.x;
Inner i1;
i1.foo();
@@ -57,4 +64,5 @@
};
}
-// FIXME: template struct N2::Outer2::Inner<float>;
+template struct N2::Outer2::Inner<float>;
+template struct N2::Outer2::Inner<int*, float*>; // expected-note{{instantiation}}