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

            Bug ID: 81836
           Summary: ill-formed qualified name not diagnosed
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g...@arne-mertz.de
  Target Milestone: ---

Consider the following code:

    typedef int foo;
    namespace Foo {
        int f();
        foo g();
    }

    int ::Foo::f() { return 0; }
    foo ::Foo::g() { return 1; }

This compiles in gcc 7.2.0 and 8.0.0 20170814, but should give an error in the
last line:

[expr.prim.id.qual] states, that `foo :: Foo` is a qualified ID. (`foo` is a
type-name). [basic.lookup.qual] then requires `foo` to denote a class,
enumeration or namespace. 

Clang, MSVC (and IAR) give diagnostics for this, see
https://godbolt.org/g/vhW9si

(`int :: Foo` is not a qualified ID because `int` is only a
simple-type-specifier, [dcl.type.simple])

But also consider open issue
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1828

Reply via email to