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
This commit is contained in:
parent
13f7d3a1c0
commit
b92bc2a028
@ -1,3 +1,9 @@
|
||||
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>
|
||||
|
||||
PR c++/12163
|
||||
|
@ -13883,6 +13883,13 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
|
||||
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))
|
||||
@ -13916,6 +13923,10 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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>
|
||||
|
||||
PR c++/12163
|
||||
|
15
gcc/testsuite/g++.dg/parse/defarg5.C
Normal file
15
gcc/testsuite/g++.dg/parse/defarg5.C
Normal file
@ -0,0 +1,15 @@
|
||||
// { 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 {};
|
||||
|
||||
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 "" }
|
||||
|
Loading…
Reference in New Issue
Block a user