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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-02 
19:12:56 UTC ---
It fails to give an error with gcc 4.3 and gcc 4.8 also. Clang complains:

/home/manuel/pr53196.c:8:18: error: variable has incomplete type 'struct
foo_typo'
  struct foo f = (struct foo_typo) { };
                 ^~~~~~~~~~~~~~~~~~~~~
/home/manuel/pr53196.c:8:26: note: forward declaration of 'struct foo_typo'     
  struct foo f = (struct foo_typo) { };
                         ^
1 error generated.

Interestingly, the code without the typo:

struct foo {
  int i;
};

int
main(void)
{
  struct foo f = (struct foo) { };
  return 0;
}

is rejected by g++:


/home/manuel/pr53196.c:8:19: error: expected primary-expression before ‘struct’
   struct foo f = (struct foo) { };
                   ^
/home/manuel/pr53196.c:8:19: error: expected ‘)’ before ‘struct’
   struct foo f = (struct foo) { };
                   ^

Reply via email to