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

            Bug ID: 90807
           Summary: Wrong debug message
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

My gcc is 10.0.0, and my code is:

void f() {
 union {
 typeof
 (
 (
 {
 unsigned long __ptr;
 (int *)(0);
 }
 )
 )
 __val;
 };
}


gcc rejects it with the following message:

x86-64 gcc (trunk)
1
<Compilation failed>
No Results
x86-64 gcc (trunk)
- cached

    #1 with x86-64 gcc (trunk)

<source>: In function 'void f()':

<source>:5:2: error: statement-expressions are not allowed outside functions
nor in template-argument lists

    5 |  (

      |  ^

Compiler returned: 1

The message seems to be wrong, since the statement-expression here is inside a
function and not inside a template-argument-list.

BTW, the code does not violate any of the rules in
https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html). Clang accepts the
code. Do you intend to allow statement-expressions inside function-local type
definitions or not.

Reply via email to