r279240 - in /trunk/gcc: cp/ChangeLog cp/init.c...

mpolacek@gcc.gnu.org mpolacek@gcc.gnu.org
Wed Dec 11 18:40:00 GMT 2019


Author: mpolacek
Date: Wed Dec 11 18:40:55 2019
New Revision: 279240

URL: https://gcc.gnu.org/viewcvs?rev=279240&root=gcc&view=rev
Log:
	PR c++/92878 - Parenthesized init of aggregates in new-expression.

Ville pointed out that our paren init of aggregates doesn't work for

  auto a = new A(1, 2, 3);

and I think it should:

A new-expression that creates an object of type T initializes that object
as follows:
...
-- Otherwise, the new-initializer is interpreted according to the
   initialization rules of [dcl.init] for direct-initialization.

so I think it follows that we should perform dcl.init#17.6.2.2.

This doesn't work with new[]; we have:
  error ("parenthesized initializer in array new");

	* init.c (build_new_1): Handle parenthesized initialization of
	aggregates in new-expression.

	* g++.dg/cpp2a/paren-init20.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp2a/paren-init20.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list