[cfe-commits] r152231 - in /cfe/trunk: lib/Sema/SemaInit.cpp test/SemaCXX/cxx0x-initializer-references.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed Mar 7 08:10:45 PST 2012


Author: cornedbee
Date: Wed Mar  7 10:10:45 2012
New Revision: 152231

URL: http://llvm.org/viewvc/llvm-project?rev=152231&view=rev
Log:
Be smarter in discovering list-initialization of temporaries. Fixes PR12182.

Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=152231&r1=152230&r2=152231&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Mar  7 10:10:45 2012
@@ -5110,7 +5110,7 @@
       // unwrap references here and rewrap them afterwards.
       // We also need to create a InitializeTemporary entity for this.
       QualType Ty = ResultType ? ResultType->getNonReferenceType() : Step->Type;
-      bool IsTemporary = ResultType && (*ResultType)->isReferenceType();
+      bool IsTemporary = Entity.getType()->isReferenceType();
       InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(Ty);
       InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity,
           InitList, Ty, /*VerifyOnly=*/false,

Modified: cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp?rev=152231&r1=152230&r2=152231&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx0x-initializer-references.cpp Wed Mar  7 10:10:45 2012
@@ -77,3 +77,11 @@
   }
 
 }
+
+namespace PR12182 {
+  void f(int const(&)[3]);
+
+  void g() {
+      f({1, 2});
+  }
+}





More information about the cfe-commits mailing list