]> granicus.if.org Git - clang/commitdiff
When testing whether we can perform copy or move initialization, be
authorDouglas Gregor <dgregor@apple.com>
Tue, 31 Jul 2012 22:15:04 +0000 (22:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 31 Jul 2012 22:15:04 +0000 (22:15 +0000)
sure to supply an initialization location. Fixes <rdar://problem/11951661>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161084 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp
test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp

index 0e5a02f3426f016e234be603de07851377634ae6..cab7661898b94d6dfd6bfd91129476da6be458f3 100644 (file)
@@ -6179,8 +6179,8 @@ Sema::CanPerformCopyInitialization(const InitializedEntity &Entity,
   Expr *InitE = Init.get();
   assert(InitE && "No initialization expression");
 
-  InitializationKind Kind = InitializationKind::CreateCopy(SourceLocation(),
-                                                           SourceLocation());
+  InitializationKind Kind
+    = InitializationKind::CreateCopy(InitE->getLocStart(), SourceLocation());
   InitializationSequence Seq(*this, Entity, Kind, &InitE, 1);
   return !Seq.Failed();
 }
index 7384309f97dabe91d9e7c8428d42a9da12eafa13..f11e19ae6f2c4b6eee32cc60570f4f858ea2a4cb 100644 (file)
@@ -175,3 +175,15 @@ namespace PR12436 {
   
   X x({}, 17);
 }
+
+namespace rdar11948732 {
+  template<typename T> struct X {};
+
+  struct XCtorInit {
+    XCtorInit(std::initializer_list<X<int>>);
+  };
+
+  void f(X<int> &xi) {
+    XCtorInit xc = { xi, xi };
+  }
+}