Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -1162,8 +1162,15 @@ APValue &CallStackFrame::createTemporary(const void *Key, bool IsLifetimeExtended) { - APValue &Result = Temporaries[Key]; - assert(Result.isUninit() && "temporary created multiple times"); + auto LB = Temporaries.lower_bound(Key); + + // If an element with key Key is found, reset the value and return it. This + // can happen if Key is part of a default argument expression. + if (LB != Temporaries.end() && LB->first == Key) + return LB->second = APValue(); + + APValue &Result = + Temporaries.insert(LB, std::make_pair(Key, APValue()))->second; Info.CleanupStack.push_back(Cleanup(&Result, IsLifetimeExtended)); return Result; } Index: test/SemaCXX/constexpr-default-arg.cpp =================================================================== --- /dev/null +++ test/SemaCXX/constexpr-default-arg.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s + +// expected-no-diagnostics + +constexpr bool equals(const float& arg = 1.0f) { + return arg == 1.0f; +} + +constexpr bool test_default_arg() { + return equals() && equals(); +}