[llvm-dev] Qualifiers not being discarded for atomic types while compiling with clang

Puneetha K via llvm-dev
Fri, 09 Jun 2017 07:21:17 -0000

Hi,
I am trying to compile the following:

char * _Atomic restrict h;

When compiled with -std=c11,clang gives error:
         "restrict requires a pointer or reference (_Atomic(char*) is
invalid)"

while gcc compiles it successfully.

Similarly, while trying to compile this

extern int i;
extern int _Atomic const ci;
extern __typeof(ci) i;

Clang gives error:

          "Redeclaration of 'i' with a different type: 'typeof
(ci)' (aka
'typeof _Atomic(int)') vs 'int' "

while gcc compiles it successfully.

This seems to be because clang probably considers Atomic int differently
than int while gcc disregards these.

Please suggest what should be the right behaviour in such cases.

Thanks in advance.
Best regards,
Puneetha
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20170609/a9d55f95/attachment.html>