[cfe-commits] r161084 - in /cfe/trunk: lib/Sema/SemaInit.cpp test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
Douglas Gregor
dgregor at apple.com
Tue Jul 31 15:15:05 PDT 2012
Author: dgregor
Date: Tue Jul 31 17:15:04 2012
New Revision: 161084
URL: http://llvm.org/viewvc/llvm-project?rev=161084&view=rev
Log:
When testing whether we can perform copy or move initialization, be
sure to supply an initialization location. Fixes <rdar://problem/11951661>.
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=161084&r1=161083&r2=161084&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Tue Jul 31 17:15:04 2012
@@ -6179,8 +6179,8 @@
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();
}
Modified: cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp?rev=161084&r1=161083&r2=161084&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp Tue Jul 31 17:15:04 2012
@@ -175,3 +175,15 @@
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 };
+ }
+}
More information about the cfe-commits
mailing list