diff options
-rw-r--r-- | lib/CodeGen/CGException.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenCXX/exceptions.cpp | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 263ac63ccc..0605f62b27 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -1034,7 +1034,8 @@ static void InitCatchParam(CodeGenFunction &CGF, // Perform the copy construction. CGF.EmitAggExpr(copyExpr, AggValueSlot::forAddr(ParamAddr, Qualifiers(), AggValueSlot::IsNotDestructed, - AggValueSlot::DoesNotNeedGCBarriers)); + AggValueSlot::DoesNotNeedGCBarriers, + AggValueSlot::IsNotAliased)); // Leave the terminate scope. CGF.EHStack.popTerminate(); diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp index 0ce9679a34..4a32de024a 100644 --- a/test/CodeGenCXX/exceptions.cpp +++ b/test/CodeGenCXX/exceptions.cpp @@ -390,3 +390,16 @@ namespace test7 { return new B(A(), new B(A(), 0)); } } + +// Just don't crash. +namespace test8 { + struct A { + A(const A&); + ~A(); + }; + + A makeA(); + void test() { + throw makeA(); + } +} |