From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32727 invoked by alias); 17 Apr 2010 07:59:17 -0000 Received: (qmail 32685 invoked by uid 48); 17 Apr 2010 07:59:02 -0000 Date: Sat, 17 Apr 2010 07:59:00 -0000 Message-ID: <20100417075902.32684.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/9335] repeated diagnostic when maximum template depth is exceeded In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-04/txt/msg01627.txt.bz2 ------- Comment #19 from manu at gcc dot gnu dot org 2010-04-17 07:59 ------- (In reply to comment #18) > The output with my patch is > > wa.C:2:38: error: template instantiation depth exceeds maximum of 1024 (use > -ftemplate-depth= to increase the maximum) instantiating �struct > X<-0x000000018>� > wa.C:2:38: instantiated from �const int X<-0x000000017>::value� > wa.C:2:38: instantiated from �const int X<-0x000000016>::value� > wa.C:2:38: instantiated from �const int X<-0x000000015>::value� > wa.C:2:38: instantiated from �const int X<-0x000000014>::value� > wa.C:2:38: instantiated from �const int X<-0x000000013>::value� > wa.C:2:38: [ skipping 1014 instantiation contexts ] > wa.C:2:38: instantiated from �const int X<996>::value� > wa.C:2:38: instantiated from �const int X<997>::value� > wa.C:2:38: instantiated from �const int X<998>::value� > wa.C:2:38: instantiated from �const int X<999>::value� > wa.C:2:38: instantiated from �const int X<1000>::value� > wa.C:4:17: instantiated from here > > wa.C:2:38: error: incomplete type �X<-0x000000018>� used in nested name > specifier > > it avoids the error cascade by avoiding all the non-constant initializer > errors. > > I guess your patch just cuts down the "instantiated from" list to one element? No, to 2 elements, the original instantiation, and the recursive instantiation. /home/manuel/src/pr9335.C:2:36: error: template instantiation depth exceeds maximum of 1024 (use -ftemplate-depth= to increase the maximum) instantiating �struct X<-0x00000000000000018>� /home/manuel/src/pr9335.C:2:36: recursively instantiated from �const int X<1000>::value� /home/manuel/src/pr9335.C:4:17: instantiated from here > I think the previous change to skip all but 10 is good enough. Well, the patch is mostly done, it reduces the output from 11 to 1 lines and it neatly points out where is the recursive instantiation. So I hope you may reconsider, unless you think the 101 lines are useful to the user somehow. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9335