This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81836] New: ill-formed qualified name not diagnosed
- From: "gcc at arne-mertz dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Aug 2017 05:22:55 +0000
- Subject: [Bug c++/81836] New: ill-formed qualified name not diagnosed
- Auto-submitted: auto-generated
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: gcc@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