diff options
author | Jason Merrill <jason@redhat.com> | 2021-06-08 09:19:58 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-06-08 13:28:02 -0400 |
commit | 91349e57bbfd010156b9128b2ad751c8843e7245 (patch) | |
tree | ccede00a9fe5084f015b879f210916bcd0a72236 /gcc/cp/call.c | |
parent | 69bb37f9e0143fbca3124069c0e9b6937ccf1fc7 (diff) | |
download | gcc-91349e57bbfd010156b9128b2ad751c8843e7245.zip gcc-91349e57bbfd010156b9128b2ad751c8843e7245.tar.gz gcc-91349e57bbfd010156b9128b2ad751c8843e7245.tar.bz2 |
c++: braced-list overload resolution [PR100963]
My PR969626 patch made us ignore template candidates when there's a perfect
non-template candidate. In this case, we were considering B(int) a perfect
match for B({0}), but the brace elision makes it imperfect.
PR c++/100963
gcc/cp/ChangeLog:
* call.c (perfect_conversion_p): Check check_narrowing.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist124.C: New test.
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 17fc60c..d2f6ca8 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5880,6 +5880,9 @@ perfect_conversion_p (conversion *conv) next_conversion (conv)->type)) return false; } + if (conv->check_narrowing) + /* Brace elision is imperfect. */ + return false; return true; } |