[PATCH] Combine instantiation context of field initializer with context of class.

Serge Pavlov sepavloff at gmail.com
Tue Apr 28 11:02:12 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9258

Files:
  cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
  cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp

Index: cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp
===================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp
+++ cfe/trunk/test/SemaTemplate/instantiate-local-class.cpp
@@ -194,3 +194,22 @@
   void f() { F<int>(); }
 };
 }
+
+namespace PR23194 {
+  struct X {
+    int operator()() const { return 0; }
+  };
+  struct Y {
+    Y(int) {}
+  };
+  template <bool = true> int make_seed_pair() noexcept {
+    struct state_t {
+      X x;
+      Y y{x()};
+    };
+    return 0;
+  }
+  int func() {
+    return make_seed_pair();
+  }
+}
Index: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2233,7 +2233,7 @@
   EnterExpressionEvaluationContext EvalContext(*this,
                                                Sema::PotentiallyEvaluated);
 
-  LocalInstantiationScope Scope(*this);
+  LocalInstantiationScope Scope(*this, true);
 
   // Instantiate the initializer.
   ActOnStartCXXInClassMemberInitializer();

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9258.24566.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150428/60cf1e11/attachment.bin>


More information about the cfe-commits mailing list