[Bug c++/62116] Allowing redeclaration of global variable x using ::x

rs2740 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 14 06:52:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62116

TC <rs2740 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rs2740 at gmail dot com

--- Comment #5 from TC <rs2740 at gmail dot com> ---
Somewhat related: http://stackoverflow.com/questions/28955859

struct Foo {
     enum { bar };
     explicit Foo(int){}
};

struct Baz { explicit Baz(Foo){} };

Baz b(Foo(Foo::bar)); // 1

Line #1 should be ill-formed because it fits the grammar for a function
declaration and is disambiguated as such. GCC considers it a variable
declaration instead. Clang rejects it - see
https://llvm.org/bugs/show_bug.cgi?id=4594.



More information about the Gcc-bugs mailing list