[Bug c++/62143] New: unlimited number of class name qualifiers allowed
haynberg at sig dot com
gcc-bugzilla@gcc.gnu.org
Thu Aug 14 18:28:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62143
Bug ID: 62143
Summary: unlimited number of class name qualifiers allowed
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haynberg at sig dot com
I'm not sure if this is a bug or allowed by the standard. Either way, it's
strange this is allowed.
$ cat t.cpp
#include <iostream>
using namespace std;
struct X {
void foo();
};
// an unlimited number of "X::"s are allowed !!
void X::X::X::X::X::foo()
{
cout << "ctor" << endl;
}
// if you uncomment this, you'll get a redefinition error
// void X::foo()
// {
// cout << "ctor" << endl;
// }
int main()
{
X x;
x.foo();
}
$ g++ t.cpp
$ a.out
ctor
$ g++ -v
...
gcc version 4.8.2 (GCC)
...
$ uname -isr
Linux 3.0.38-0.5-default x86_64
More information about the Gcc-bugs
mailing list