r176723 - <rdar://problem/13140795> Transform the scope type of a pseudo-destructor expression within the object scope.

Douglas Gregor dgregor at apple.com
Fri Mar 8 13:25:01 PST 2013


Author: dgregor
Date: Fri Mar  8 15:25:01 2013
New Revision: 176723

URL: http://llvm.org/viewvc/llvm-project?rev=176723&view=rev
Log:
<rdar://problem/13140795> Transform the scope type of a pseudo-destructor expression within the object scope.

We were transforming the scope type of a pseudo-destructor expression
(e.g., the first T in x->T::~T()) as a freestanding type, which meant
that dependent template specialization types here would stay dependent
even when no template parameters were named. This would eventually
mean that a dependent expression would end up in what should be
fully-instantiated ASTs, causing IRgen to assert.

Modified:
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/test/SemaTemplate/destructor-template.cpp

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=176723&r1=176722&r2=176723&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Mar  8 15:25:01 2013
@@ -7459,7 +7459,9 @@ TreeTransform<Derived>::TransformCXXPseu
 
   TypeSourceInfo *ScopeTypeInfo = 0;
   if (E->getScopeTypeInfo()) {
-    ScopeTypeInfo = getDerived().TransformType(E->getScopeTypeInfo());
+    CXXScopeSpec EmptySS;
+    ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
+                      E->getScopeTypeInfo(), ObjectType, 0, EmptySS);
     if (!ScopeTypeInfo)
       return ExprError();
   }

Modified: cfe/trunk/test/SemaTemplate/destructor-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/destructor-template.cpp?rev=176723&r1=176722&r2=176723&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/destructor-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/destructor-template.cpp Fri Mar  8 15:25:01 2013
@@ -57,3 +57,22 @@ namespace PR7904 {
   };
   Foo f;
 }
+
+namespace rdar13140795 {
+  template <class T> class shared_ptr {};
+
+  template <typename T> struct Marshal {
+    static int gc();
+  };
+
+
+  template <typename T> int Marshal<T>::gc() {
+    shared_ptr<T> *x;
+    x->template shared_ptr<T>::~shared_ptr();
+    return 0;
+  }
+
+  void test() {
+    Marshal<int>::gc();
+  }
+}





More information about the cfe-commits mailing list