c++/9443: [3.4 regression] ICE when accessing a nonstatic member as A::i
Volker Reichelt
reichelt@igpm.rwth-aachen.de
Thu Apr 10 19:43:00 GMT 2003
For the record:
* The ICE in the case with "A::i" is fixed (mainline as of gcc 20030406).
The error message, however, could still use some improvement:
PR9443A.cc: In member function `int B<<anonymous> >::foo() [with int
<anonymous> = 0]':
PR9443A.cc:15: instantiated from here
PR9443A.cc:12: error: 'struct B<0>' has no member named 'i'
We tried to access A::i and not B<0>::i as the error message suggests.
This is as bad as the message on the 3.3 branch:
PR9443A.cc: In member function `int B<<anonymous> >::foo() [with int
<anonymous> = 0]':
PR9443A.cc:15: instantiated from here
PR9443A.cc:12: error: type `A' is not a base type for type `B<0>'
In fact you can make the code legal if you derive B from A, so this
might actually help in some situations.
* The accepts-illegal bug in the case "A::j" still persists on mainline.
I changed the synopsis to reflect the situation.
* I probably reduced the testcase a little too much. The ICE also happened
with the following testcase which is indeed legal-code (and reflects the
problem in the original example more accurately). As a side-effect
the synopsis was a bit misleading, but I changed that anyway.
------------------------snip here----------------------
struct A
{
int i;
};
template <int> struct B : A
{
int foo() { return A::i; }
};
void bar() { B<0>().foo(); }
------------------------snip here----------------------
This should answer your question, Giovanni, at least partially: Boost
doesn't contain illegal code (at least not in that spot).
The boost problems regarding the 3.3 branch are probably a different
issue (an ICE in c_expand_expr, at c-common.c happens quite often -
the reason for the failure is usually buried elsewhere).
Alas there are no more recent results available on
http://cci.lbl.gov/boost/results/
The tests were performed with gcc 3.3-20030306. If the problems with the
3.3 branch persist, we should probably have a look at it. Could you test
it with a more recent compiler, Giovanni?
Regards,
Volker
More information about the Gcc-bugs
mailing list