Commit b92bc2a0 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/12167 (ICE on default argument of class member function if non-simple)

cp:
	PR c++/12167
	* parser.c (cp_parser_late_parsing_default_args): Push & pop the
	unparsed functions queue.
testsuite:
	PR c++/12167
	* g++.dg/parse/defarg5.C: New test.

	* g++.dg/template/non-type-template-argument-1.C: Tweak expected error.

From-SVN: r71133
parent 13f7d3a1
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.
2003-09-05 Mark Mitchell <mark@codesourcery.com> 2003-09-05 Mark Mitchell <mark@codesourcery.com>
PR c++/12163 PR c++/12163
......
...@@ -13883,6 +13883,13 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) ...@@ -13883,6 +13883,13 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
bool saved_local_variables_forbidden_p; bool saved_local_variables_forbidden_p;
tree parameters; 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)); for (parameters = TYPE_ARG_TYPES (TREE_TYPE (fn));
parameters; parameters;
parameters = TREE_CHAIN (parameters)) parameters = TREE_CHAIN (parameters))
...@@ -13916,6 +13923,10 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) ...@@ -13916,6 +13923,10 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
parser->lexer = saved_lexer; parser->lexer = saved_lexer;
parser->local_variables_forbidden_p = saved_local_variables_forbidden_p; 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 /* Parse the operand of `sizeof' (or a similar operator). Returns
......
2003-09-06 Nathan Sidwell <nathan@codesourcery.com>
PR c++/12167
* g++.dg/parse/defarg5.C: New test.
* g++.dg/template/non-type-template-argument-1.C: Tweak expected error.
2003-09-05 Mark Mitchell <mark@codesourcery.com> 2003-09-05 Mark Mitchell <mark@codesourcery.com>
PR c++/12163 PR c++/12163
......
// { 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));
};
...@@ -6,7 +6,7 @@ template <bool> struct C {}; ...@@ -6,7 +6,7 @@ template <bool> struct C {};
template <typename T> struct D template <typename T> struct D
{ {
C<T::X> c; // { dg-error "invalid use" } C<T::X> c; // { dg-error "names a type" }
}; };
D<B> d; // { dg-error "" } D<B> d; // { dg-error "" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment