[cfe-dev] Is this valid code ?

James Dennett james.dennett at gmail.com
Sat Jul 11 02:48:26 PDT 2015


On Sat, Jul 11, 2015 at 1:25 AM, Manasij Mukherjee <manasij7479 at gmail.com>
wrote:

> Hi
> Clang and MSVC accepts the following code.
> But I get
> error: use of 'x' before deduction of 'auto'
> with GCC (5.1, C++14 enabled)
>
> int main() {
>   int x[] = {1,2,3,4,5};
>   for (auto x : x) {
>   }
> }
>
> Thanks,
> Manasij Mukherjee
>

This is a longstanding bug in GCC (and arguably the wrong mailing list for
a GCC-centric question).

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54430 for the bug's
history.

-- James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150711/de7d6387/attachment.html>


More information about the cfe-dev mailing list