C++: Internal compiler error
Mark Mitchell
mark@codesourcery.com
Mon Apr 24 11:59:00 GMT 2000
>>>>> "Martin" == Martin v Loewis <martin@loewis.home.cs.tu-berlin.de> writes:
Martin> Both work fine. cp_convert comes back with a constant in
Martin> these cases, as it uses decl_constant_value if it find
Martin> that the declaration is a constant expression. I only need
Martin> the check for 'integral constant', not the actual value.
Thanks for answering my specific questions.
My main objection is to the difference in the way your code and the
other code works. They're doing conceptually the same thing; they
might as well do it the same way. The safest thing seems to me to let
the existing code do its job; then see what it did.
>> I wonder if you shouldn't check for this problem later in the
>> game, after the array type is created a few lines below your
>> patch. Then, all you have to do is check that the TYPE_DOMAIN
>> is TREE_CONSTANT, and fix up the type (for error-reporting
>> purposes) if not.
Martin> I think the type cannot be changed afterwards, since it is
I didn't mean to change the ARRAY_TYPE; I meant to change the
TREE_TYPE of the node.
Martin> already hashed. Also, in this case, it would produce two
Martin> diagnostic messages for the same problem under -pedantic
Martin> (first would be a pedwarn that VLAs are not standard C++,
Martin> and then it would cp_error that they won't work at all as
Martin> members).
That's easily fixed; pass a flag to see if an error occurred. Or,
formalize (behind a push_error_check/pop_error_check interface) the
trick used elsewhere in GCC to see if an error message has occurred
somewhere. I think there's an `error_tick' variable or something.
It's a reasonable thing to have an interface for checking to see
whether or not doing something caused an error to be issued.
But, in this case, I don't see any problem with having two error
messages. It's a rare situation, and both error messages are
accurate.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-bugs
mailing list