From: Douglas Gregor Date: Wed, 28 Jul 2010 15:14:14 +0000 (+0000) Subject: Enable expression transformations in the current-instantiation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6813d7ba5fa79e36bdb3986e7f3f8100915a61ab;p=clang Enable expression transformations in the current-instantiation rebuilder, i.e., remove a silly short-sighted hack from long ago. Thanks to Abramo Bagnara for the test case/bug report! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109583 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index ea77a189f7..03e5281d83 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -5427,15 +5427,6 @@ namespace { this->Loc = Loc; this->Entity = Entity; } - - /// \brief Transforms an expression by returning the expression itself - /// (an identity function). - /// - /// FIXME: This is completely unsafe; we will need to actually clone the - /// expressions. - Sema::OwningExprResult TransformExpr(Expr *E) { - return getSema().Owned(E->Retain()); - } }; } diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index c631dd71d1..8caac9399a 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -164,3 +164,38 @@ namespace ConstantInCurrentInstantiation { template int X::array[X::value] = { 1, 2 }; } + +namespace Expressions { + template + struct Bool { + enum anonymous_enum { value = b }; + }; + struct True : public Bool {}; + struct False : public Bool {}; + + template + struct Is_Same : public False {}; + template + struct Is_Same : public True {}; + + template + struct Enable_If {}; + template + struct Enable_If { + typedef T type; + }; + + template + class Class { + public: + template + typename Enable_If::value, void>::type + foo(); + }; + + + template + template + typename Enable_If >::value, void>::type + Class::foo() {} +}