[cfe-dev] _Generic compiles fine in c++ source

Prathamesh Kulkarni bilbotheelffriend at gmail.com
Fri Jan 17 23:48:08 PST 2014

Hi, sorry to ask a daft question but why does the following code
compile fine with clang/clang++ ?

int main()
  int a = _Generic(1, int: 2);
  int &x = a;

As far as I know, it does not conform to either C or C++ ( I believe
_Generic is not supported by C++ ? ).
It fails to compile with g++.

Thanks and Regards,

More information about the cfe-dev mailing list