forked from OSchip/llvm-project
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:
parent
b03f6c489a
commit
03d9393b4a
|
@ -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.
|
||||
|
|
|
@ -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> });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue