Don't crash when binding a reference to a temporary pointer created from

resolving an overloaded function reference within an initializer list.
Previously we would try to resolve the overloaded function reference without
first stripping off the InitListExpr wrapper.

llvm-svn: 172517
This commit is contained in:
Richard Smith 2013-01-15 07:58:29 +00:00
parent b03f6c489a
commit 03d9393b4a
2 changed files with 11 additions and 0 deletions

View File

@ -3024,6 +3024,10 @@ static void TryReferenceListInitialization(Sema &S,
Sequence.RewrapReferenceInitList(cv1T1, InitList);
return;
}
// Update the initializer if we've resolved an overloaded function.
if (Sequence.step_begin() != Sequence.step_end())
Sequence.RewrapReferenceInitList(cv1T1, InitList);
}
// Not reference-related. Create a temporary and bind to that.

View File

@ -90,3 +90,10 @@ namespace PR12660 {
const int &i { 1 };
struct S { S(int); } const &s { 2 };
}
namespace b7891773 {
typedef void (*ptr)();
template <class T> void f();
int g(const ptr &);
int k = g({ f<int> });
}