[cfe-dev] [llvm-dev] __auto_type doesn't warn when a pointer is used as a declarator
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Fri Jun 9 15:09:13 PDT 2017
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/cfe-dev/attachments/20170609/4bd963dd/attachment.html>
More information about the cfe-dev
mailing list