c++: Make braced-init-list as template arg work with aggr init [PR95369]
authorMarek Polacek <polacek@redhat.com>
Fri, 5 Jun 2020 18:22:35 +0000 (14:22 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 5 Jun 2020 19:51:08 +0000 (15:51 -0400)
commitcecc73af4980004502f4c327b6c639125defb379
treea15c8551d20854becb91364baad2b8bfa8d720c9
parentbcd96c9cce962ca5b2c6f8459597fb759f945ccf
c++: Make braced-init-list as template arg work with aggr init [PR95369]

Barry pointed out to me that our braced-init-list as a template-argument
extension doesn't work as expected when we aggregate-initialize.  Since
aggregate list-initialization is a user-defined conversion sequence, we
allow it as part of a converted constant expression.

Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/cp/ChangeLog:

PR c++/95369
* call.c (build_converted_constant_expr_internal): Allow
list-initialization.

gcc/testsuite/ChangeLog:

PR c++/95369
* g++.dg/cpp2a/nontype-class38.C: New test.
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp2a/nontype-class38.C [new file with mode: 0644]