diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-01-11 12:29:20 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-01-11 12:29:20 +0000 |
commit | 96a1e32dcdf973cab1c308cfcdfcf6f07444b2cc (patch) | |
tree | ec5b5da0d3a77d08ddf43c7b5c39291e71111bc5 /gcc/cp/call.c | |
parent | 34e225a30bcb010bc46846eb3ea6ad9e1321034d (diff) | |
download | gcc-96a1e32dcdf973cab1c308cfcdfcf6f07444b2cc.zip gcc-96a1e32dcdf973cab1c308cfcdfcf6f07444b2cc.tar.gz gcc-96a1e32dcdf973cab1c308cfcdfcf6f07444b2cc.tar.bz2 |
call.c (convert_default_arg): Check for unprocessed DEFAULT_ARG.
cp:
* call.c (convert_default_arg): Check for unprocessed
DEFAULT_ARG.
* cp-tree.h (replace_defarg): Move to spew.c.
(maybe_snarf_defarg, add_defarg_fn, do_pending_defargs): Move to
spew.c, which is where they really are.
(done_pending_defargs): Declare.
(unprocessed_defarg_fn): Declare.
* decl.c (replace_defarg): Move to spew.c
* parse.y (structsp): Call done_pending_defargs.
* spew.c (defarg_fns): Rearrange list structure.
(defarg_fnsdone): New static variable.
(defarg_depfns): New static variable.
(init_spew): Adjust.
(add_defarg_fn): Store the type in TREE_TYPE.
(do_pending_defargs): Detect and deal with ordering constraints
and circularity.
(done_pending_defargs): New function.
(unprocessed_defarg_fn): New function.
(replace_defarg): Moved from decl.c. Robustify. Don't save
if circularity detected.
testsuite:
* g++.old-deja/g++.other/defarg7.C: New test.
* g++.old-deja/g++.other/defarg8.C: New test.
From-SVN: r38903
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a855963..5f12f7e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3953,6 +3953,26 @@ convert_default_arg (type, arg, fn, parmnum) tree fn; int parmnum; { + if (TREE_CODE (arg) == DEFAULT_ARG) + { + /* When processing the default args for a class, we can find that + there is an ordering constraint, and we call a function who's + default args have not yet been converted. For instance, + class A { + A (int = 0); + void Foo (A const & = A ()); + }; + We must process A::A before A::Foo's default arg can be converted. + Remember the dependent function, so do_pending_defargs can retry, + and check loops. */ + unprocessed_defarg_fn (fn); + + /* Don't return error_mark node, as we won't be able to distinguish + genuine errors from this case, and that would lead to repeated + diagnostics. Just make something of the right type. */ + return build1 (NOP_EXPR, type, integer_zero_node); + } + if (fn && DECL_TEMPLATE_INFO (fn)) arg = tsubst_default_argument (fn, type, arg); |