This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix PR 10471
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 23 Apr 2003 23:05:14 -0700
- Subject: C++ PATCH: Fix PR 10471
- Reply-to: mark at codesourcery dot com
This patch fixes a defect in my recent inlining/exceptions patch.
Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com
2003-04-23 Mark Mitchell <mark at codesourcery dot com>
PR c++/10471
* call.c (build_cxx_call): Robustify.
2003-04-23 Mark Mitchell <mark at codesourcery dot com>
PR c++/10471
* g++.dg/template/defarg2.C: New test.
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.377
diff -c -5 -p -r1.377 call.c
*** cp/call.c 22 Apr 2003 05:44:07 -0000 1.377
--- cp/call.c 24 Apr 2003 05:50:51 -0000
*************** build_cxx_call(tree fn, tree args, tree
*** 4735,4745 ****
fn = build_call (fn, converted_args);
/* If this call might throw an exception, note that fact. */
fndecl = get_callee_fndecl (fn);
! if ((!fndecl || !TREE_NOTHROW (fndecl)) && at_function_scope_p ())
cp_function_chain->can_throw = 1;
/* Some built-in function calls will be evaluated at compile-time in
fold (). */
fn = fold (fn);
--- 4735,4747 ----
fn = build_call (fn, converted_args);
/* If this call might throw an exception, note that fact. */
fndecl = get_callee_fndecl (fn);
! if ((!fndecl || !TREE_NOTHROW (fndecl))
! && at_function_scope_p ()
! && cfun)
cp_function_chain->can_throw = 1;
/* Some built-in function calls will be evaluated at compile-time in
fold (). */
fn = fold (fn);
Index: testsuite/g++.dg/template/defarg2.C
===================================================================
RCS file: testsuite/g++.dg/template/defarg2.C
diff -N testsuite/g++.dg/template/defarg2.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/defarg2.C 24 Apr 2003 05:50:51 -0000
***************
*** 0 ****
--- 1,10 ----
+ struct X {
+ X ();
+ };
+
+ template <int> struct O {
+ struct I {
+ I (const X & = X());
+ };
+ };
+ template struct O<2>;