[llvm-branch-commits] [cfe-branch] r118563 - in /cfe/branches/Apple/whitney: lib/Sema/SemaTemplateInstantiateDecl.cpp test/SemaTemplate/anonymous-union.cpp

Daniel Dunbar daniel at zuster.org
Tue Nov 9 09:32:01 PST 2010


Author: ddunbar
Date: Tue Nov  9 11:32:01 2010
New Revision: 118563

URL: http://llvm.org/viewvc/llvm-project?rev=118563&view=rev
Log:
Merge r118313:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Fri Nov 5 23:22:45 2010 +0000

    When searching for an instantiated declaration requires instantiation
    of its parent context, be sure to update the parent-context pointer
    after instantiation. Fixes two anonymous-union instantiation issues in
    <rdar://problem/8635664>.

Modified:
    cfe/branches/Apple/whitney/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/branches/Apple/whitney/test/SemaTemplate/anonymous-union.cpp

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=118563&r1=118562&r2=118563&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Nov  9 11:32:01 2010
@@ -2753,6 +2753,8 @@
         if (!Tag->isBeingDefined() &&
             RequireCompleteType(Loc, T, diag::err_incomplete_type))
           return 0;
+
+        ParentDC = Tag->getDecl();
       }
     }
 

Modified: cfe/branches/Apple/whitney/test/SemaTemplate/anonymous-union.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaTemplate/anonymous-union.cpp?rev=118563&r1=118562&r2=118563&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaTemplate/anonymous-union.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaTemplate/anonymous-union.cpp Tue Nov  9 11:32:01 2010
@@ -17,3 +17,24 @@
 struct A : public T0 { };
 
 void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}}
+
+namespace rdar8635664 {
+  template<typename T>
+  struct X {
+    struct inner;
+  
+    struct inner {
+      union {
+        int x;
+        float y;
+      };
+
+      typedef T type;
+    };
+  };
+
+  void test() {
+    X<int>::inner i;
+    i.x = 0;
+  }
+}





More information about the llvm-branch-commits mailing list