https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116844
Bug ID: 116844 Summary: (cwg2876) - Disambiguation of T x = delete("text") Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- The CWG says that we should decide based on declarator type whether something starting with { or = is a function definition or variable initializer. Seems we decide based on function_declarator_p (declarator) instead. So the DR2144 int f () {}; int a {}; template <typename T> T b {}; void g () { b<int ()>; } example is I think ok, on the first line we warn about missing return, i.e. it is correctly parsed as function definition, the second line is correctly passed as variable with {} initialization, and we error on trying to define a variable with function type through template. But on the using T = void (); using U = int; T a = delete ("hello"); U b = delete ("hello"); we actually choose to parse it as variable initializers in both cases dr2876.C:4:15: warning: deleting array ‘("hello")’ 4 | T a = delete ("hello"); | ~^~~~~~~~ dr2876.C:4:7: error: function ‘void a()’ is initialized like a variable 4 | T a = delete ("hello"); | ^~~~~~~~~~~~~~~~ dr2876.C:5:15: warning: deleting array ‘("hello")’ 5 | U b = delete ("hello"); | ~^~~~~~~~ dr2876.C:5:7: error: void value not ignored as it ought to be 5 | U b = delete ("hello"); | ^~~~~~~~~~~~~~~~ and then error on the first because it is variable-like initialization of function, rather than try to parse it as function definition in the first case and then complain that it has function type through typedef/using.