Puneetha K via llvm-dev
2017-Jun-09 09:07 UTC
[llvm-dev] __auto_type doesn't warn when a pointer is used as a declarator
Hi, __auto_type *p = (int *) 0; This compiles with no problem, but GCC gives an error that we can only use plain identifier as a declarator. Please confirm if clang behavior is valid. Thanks in advance, Best regards, Puneetha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170609/f6d92408/attachment.html>
Tim Northover via llvm-dev
2017-Jun-09 14:13 UTC
[llvm-dev] __auto_type doesn't warn when a pointer is used as a declarator
On 9 June 2017 at 02:07, Puneetha K via llvm-dev <llvm-dev at lists.llvm.org> wrote:> __auto_type *p = (int *) 0; > > This compiles with no problem, but GCC gives an error that we can only use > plain identifier as a declarator.At the very least Clang's behaviour is consistent with "auto" in C++, which I think is a good thing. Tim.
Richard Smith via llvm-dev
2017-Jun-09 22:09 UTC
[llvm-dev] [cfe-dev] __auto_type doesn't warn when a pointer is used as a declarator
On 9 June 2017 at 07:13, Tim Northover via cfe-dev <cfe-dev at lists.llvm.org> wrote:> On 9 June 2017 at 02:07, Puneetha K via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > __auto_type *p = (int *) 0; > > > > This compiles with no problem, but GCC gives an error that we can only > use > > plain identifier as a declarator. > > At the very least Clang's behaviour is consistent with "auto" in C++, > which I think is a good thing.If someone wanted to put a patch together, it would seem reasonable to issue a -Wgcc-compat warning on cases that we know GCC rejects. (We also don't quite follow the GCC semantics: per GCC's documentation, an __auto_type variable is not in scope in its own initializer, whereas Clang's approach makes it an error to name the variable within its initializer, like 'auto' in C++. But at least that means we reject a superset of what GCC rejects.) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170609/4bd963dd/attachment.html>
Apparently Analagous Threads
- [LLVMdev] static keyword @ Function declarators...
- building in AIXV5.3 using the IBM C for AIX compiler V6.0
- [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y
- [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y
- v2.2.25 release candidate released