tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] spurious "cast expected" error when initialising a st


From: Thomas Preudhomme
Subject: Re: [Tinycc-devel] spurious "cast expected" error when initialising a struct
Date: Mon, 31 Mar 2014 23:05:46 +0800
User-agent: Roundcube Webmail/0.7.2

Le 2014-03-31 21:36, address@hidden a écrit :
On Mon, Mar 31, 2014 at 01:42:36PM +0100, Jay Foad wrote:
In this example I get a spurious error, but only when I elide some
braces *and* put parentheses around the literal:

$ cat a.c
struct {
  struct {
    int i;
  } a;
} x = {
  (3)
};
$ ./tcc a.c
a.c:6: error: cast expected

Some compilers accept it but issues warning (with -Wall).
The following should always be valid:

struct {
   struct {
     int i;
   } a;
} x = {
   {3}
};

At least according to C99 not all parenthesis are necessary if there is no ambiguity. It's a known bug but nobody found time / interest to work on this yet. Maybe for tcc 0.9.27 as I remember grischka warning that the current code is not adapted to detect this and some important changes would be needed.

Best regards,

Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]