When instantiating anonymous structs/unions within a function, make
sure that the anonymous struct/union record declaration gets
instantiated before the variable declaration, and that it and its
fields (recursively) get entries in the local instantiation map. Fixes
PR7088.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104305 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp
index 7c75885..255454b 100644
--- a/test/SemaTemplate/instantiate-anonymous-union.cpp
+++ b/test/SemaTemplate/instantiate-anonymous-union.cpp
@@ -29,3 +29,21 @@
};
C<int> c0(0);
+
+namespace PR7088 {
+ template<typename T>
+ void f() {
+ union {
+ int a;
+ union {
+ float real;
+ T d;
+ };
+ };
+
+ a = 17;
+ d = 3.14;
+ }
+
+ template void f<double>();
+}