Bug 17421 - g++ accepts invalid qualified declarator-id
Summary: g++ accepts invalid qualified declarator-id
Status: RESOLVED DUPLICATE of bug 18466
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2004-09-11 19:29 UTC by Paul Pluzhnikov
Modified: 2004-12-01 02:04 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 3.1 3.2 3.3 3.4.0 3.4.2
Last reconfirmed: 2004-09-12 22:57:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pluzhnikov 2004-09-11 19:29:44 UTC
This is similar to, but not exactly like, bug 16782

$ cat junk.cc
void ::foo() { }

$ /usr/local/gcc-3.4.2/bin/g++ -c junk.cc -Wall
$ edgcpfe junk.cc
"junk.cc", line 1: error: the global scope has no "foo"
  void ::foo() { }
         ^
1 error detected in the compilation of "junk.cc".


The Standard (ISO+IEC+14882-1998) says in 8.3 paragraph 1:

 When the declarator-id is qualified,
 the declaration shall refer to a previously declared member of the
 class or namespace to which the qualifier refers, and the member
 shall not have been introduced by a usingdeclaration in the scope
 of the class or namespace nominated by the nested-name-specifier of
 the declarator-id.
Comment 1 Wolfgang Bangerth 2004-09-12 22:57:25 UTC
Confirmed. 
Comment 2 Volker Reichelt 2004-12-01 02:04:06 UTC
This is more or less a duplicate of PR 18466.

The problem was fixed on mainline by Mark. He also added the testcase
g++.dg/parse/qualified3.C which contains the example above. So let's
track the problem in PR 18466.

*** This bug has been marked as a duplicate of 18466 ***