aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/instantiate-anonymous-union.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-21 00:31:19 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-21 00:31:19 +0000
commit9901c57806f7e36736ed1616e6ab3eebcc99b78c (patch)
tree7d532fc130ac8fe817cdf593a0cf44033fe38d74 /test/SemaTemplate/instantiate-anonymous-union.cpp
parent073190dcb6f8186cfcc3ebb65c2802d2024729b0 (diff)
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
Diffstat (limited to 'test/SemaTemplate/instantiate-anonymous-union.cpp')
-rw-r--r--test/SemaTemplate/instantiate-anonymous-union.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp
index 7c75885788..255454b2eb 100644
--- a/test/SemaTemplate/instantiate-anonymous-union.cpp
+++ b/test/SemaTemplate/instantiate-anonymous-union.cpp
@@ -29,3 +29,21 @@ template <typename T> struct C {
};
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>();
+}