When compiling the following program:

struct S {int z;};
typedef S* (*FuncType)(int,int);
int x,y;
S* a() {
  FuncType(a)(x,y)->z = 0; // treated as declaration
  return 0;
}


This is the result:

t.cpp: In function 'S* a()':
t.cpp:5: error: initializer expression list treated as compound expression
t.cpp:5: error: invalid conversion from 'int' to 'S* (*)(int, int)'
t.cpp:5: error: expected ',' or ';' before '->' token


Shouldn't GCC examine '->' after 'FuncType(a)(x,y)' and conclude that the
statement is an expression instead of a declaration ?


-- 
           Summary: Declaration/expression ambiguity resolution does not
                    extend beyond initializer
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: akyrtzi at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213

Reply via email to