Skip to content
Snippets Groups Projects
Commit c20f7e99 authored by Marek Polacek's avatar Marek Polacek Committed by Marek Polacek
Browse files

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.

From-SVN: r279240
parent cc3b6728
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment