This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9335: Inordinately long output when maximum template depth is exceeded


>Number:         9335
>Category:       c++
>Synopsis:       Inordinately long output when maximum template depth is exceeded
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 15 14:36:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
all versions of gcc
>Description:
This template meta-programming equivalent of an infinite loop
------------------------
template <int N> struct X {
    static const int value = X<N-1>::value;
};
template struct X<1000>;
------------------------
generates inordinately long and un-useful output, namely one
line per intermediate class:

g/a> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc
x.cc:2: error: template instantiation depth exceeds maximum of 500 (use
   -ftemplate-depth-NN to increase the maximum) instantiating `struct X<500>'
x.cc:2:   instantiated from `X<501>'
x.cc:2:   instantiated from `X<502>'
x.cc:2:   instantiated from `X<503>'
[...]
x.cc:2:   instantiated from `X<1000>'
x.cc:4:   instantiated from here
x.cc:2: error: incomplete type `X<500>' does not have member `value'

I think this should be cut-down somehow. Since the default
value for -ftemplate-depth has been raised from 17 to 500,
showing the whole list is no longer useful.

On the other hand, this is really a very minor nuisance, so
I lowered all priorities for this one.

W.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]