This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ rejects legal?
Richard Guenther wrote:
> Ah, I see. That makes sense. Can this be detected (I'm sure it is,
> or we would be endlessly looping(?)) and the diagnostic improved?
Well, right now it works because of a trick (while instantiating a given type,
we set the "complete" flag immediatly, so that if its instantiation is required
recursively, the type is found to be complete but empty). I think this is
implementation defined / undefined behaviour.
Probably the diagnostic could be improved, yes. This would require having a
temporary flag for each type saying "this type is being instantiated". If later
we try to instantiated it again, we can bail out with the decent error message.
You can file a diagnostic enhancement PR for this, but don't hold your breath
:)
Giovanni Bajo