https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128317

            Bug ID: 128317
           Summary: Accepts-invalid  new-expression with parenthesized
                    braced-init-list for scalar type
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 652023330028 at smail dot nju.edu.cn
  Target Milestone: ---

```c++
int *p = new int({0});
```


```
$ g++ -std=c++17 -pedantic-errors -c t.cpp
$ echo $?
0
```
No error or warning is printed.


[dcl.init.general] says:

> If the entity being initialized does not have class or array type, the 
> expression-list in a parenthesized initializer shall be a single expression.


For comparison, Clang trunk rejects it 
https://godbolt.org/z/PnbcqfrzK:

```
$ clang++ -std=c++17 -pedantic-errors -c t.cpp
t.cpp:1:14: error: cannot initialize non-class type 'int' with a parenthesized
initializer list
```

Reply via email to