[PATCH] D17576: Fix assertion failure on MaybeODRUseExprs.

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 15:10:17 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261803: Fix assertion failure on MaybeODRUseExprs. (authored by mren).

Changed prior to commit:
  http://reviews.llvm.org/D17576?vs=48963&id=48986#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17576

Files:
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/test/SemaTemplate/default-arguments-cxx0x.cpp

Index: cfe/trunk/test/SemaTemplate/default-arguments-cxx0x.cpp
===================================================================
--- cfe/trunk/test/SemaTemplate/default-arguments-cxx0x.cpp
+++ cfe/trunk/test/SemaTemplate/default-arguments-cxx0x.cpp
@@ -75,3 +75,13 @@
     g<int>();
   }
 }
+
+// rdar://problem/24480205
+namespace PR13986 {
+  constexpr unsigned Dynamic = 0;
+  template <unsigned> class A { template <unsigned = Dynamic> void m_fn1(); };
+  class Test {
+    ~Test() {}
+    A<1> m_target;
+  };
+}
Index: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2110,6 +2110,8 @@
     Param->setInvalidDecl();
 
   if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
+    EnterExpressionEvaluationContext ConstantEvaluated(SemaRef,
+                                                       Sema::ConstantEvaluated);
     ExprResult Value = SemaRef.SubstExpr(D->getDefaultArgument(), TemplateArgs);
     if (!Value.isInvalid())
       Param->setDefaultArgument(Value.get());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17576.48986.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160224/74491a85/attachment.bin>


More information about the cfe-commits mailing list