This is the mail archive of the gcc-patches@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++ PATCH]: Fix 12167


Hi,
I've installed this obvious patch for 12167, where we went into an infinite
recursion.

booted & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-09-06  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/12167
	* parser.c (cp_parser_late_parsing_default_args): Push & pop the
	unparsed functions queue.

Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.108
diff -c -3 -p -r1.108 parser.c
*** cp/parser.c	4 Sep 2003 09:36:19 -0000	1.108
--- cp/parser.c	6 Sep 2003 11:25:16 -0000
*************** cp_parser_late_parsing_default_args (cp_
*** 13883,13888 ****
--- 13883,13895 ----
    bool saved_local_variables_forbidden_p;
    tree parameters;
  
+   /* While we're parsing the default args, we might (due to the
+      statement expression extension) encounter more classes.  We want
+      to handle them right away, but we don't want them getting mixed
+      up with default args that are currently in the queue.  */
+   parser->unparsed_functions_queues
+     = tree_cons (NULL_TREE, NULL_TREE, parser->unparsed_functions_queues);
+ 
    for (parameters = TYPE_ARG_TYPES (TREE_TYPE (fn));
         parameters;
         parameters = TREE_CHAIN (parameters))
*************** cp_parser_late_parsing_default_args (cp_
*** 13916,13921 ****
--- 13923,13932 ----
        parser->lexer = saved_lexer;
        parser->local_variables_forbidden_p = saved_local_variables_forbidden_p;
      }
+ 
+   /* Restore the queue.  */
+   parser->unparsed_functions_queues 
+     = TREE_CHAIN (parser->unparsed_functions_queues);
  }
  
  /* Parse the operand of `sizeof' (or a similar operator).  Returns
// { dg-do compile }

// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sep 2003 <nathan@codesourcery.com>
// Origin:Wolfgang Bangerth bangerth@dealii.org

// PR c++/12167 - infinite recursion

class A {   
  void report(int d
	      // the default arg is what NAN etc can expand to, but
	      // with the floatiness removed.
	      = (__extension__ ((union { unsigned l; int d; })
				{ l: 0x7fc00000U }).d));
};

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