g++ rejects legal?
Richard Guenther
rguenth@tat.physik.uni-tuebingen.de
Thu Nov 4 13:54:00 GMT 2004
On Thu, 4 Nov 2004, Giovanni Bajo wrote:
> Richard Guenther wrote:
>
> > Hi!
> > There must be some weird C++ rules again. Consider:
>
> Recursive instantiations.
>
> You are trying to instantiate ComponentView<>, which, for some reason, requires
> Array<> to be complete. Completing Array<> requires instantiating the prototype
> of Array<>::comp() which, in turn, asks for ComponentView<> instantiation.
>
> This does not happen with AltComponentView<> since its instantiation is not
> required to complete Array<> so there is no loop.
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? Like
notype.cpp: In instantiation of 'Array<1, double, Brick>':
notype.cpp:33: instantiated from `ComponentView<Loc<1>, foo()::Array_t>'
notype.cpp:78: instantiated from here
notype.cpp:71: error: trying to recursively instatiate
`ComponentView<Loc<1>, foo()::Array_t>' through 'Type_t' in
'struct ComponentView<Loc<1>, foo()::Array_t>'
or the like? Would have saved me half a day ;)
Thanks,
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
More information about the Gcc
mailing list