diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-09-21 05:44:10 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-09-21 05:44:10 +0000 |
commit | 9b60dfd716eda005cfc592129da66acdb210ee22 (patch) | |
tree | 06bdae24ad68e9a57a101d63e814c4225877ee2b | |
parent | 79b82df36c0337afa82db85f0a65df7eaf4dd7f7 (diff) | |
download | gcc-9b60dfd716eda005cfc592129da66acdb210ee22.zip gcc-9b60dfd716eda005cfc592129da66acdb210ee22.tar.gz gcc-9b60dfd716eda005cfc592129da66acdb210ee22.tar.bz2 |
re PR c++/17530 (failure to emit inline function)
PR c++/17530
* pt.c (tsubst): Fix parentheses to accomodate emacs.
(tsubst_baselink): If we get a single function, mark it as used.
PR c++/17530
* g++.dg/template/static7.C: New test.
From-SVN: r87791
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/static7.C | 16 |
4 files changed, 42 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 431e32a..6ddc16d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-09-20 Mark Mitchell <mark@codesourcery.com> + + PR c++/17530 + * pt.c (tsubst): Fix parentheses to accomodate emacs. + (tsubst_baselink): If we get a single function, mark it as used. + 2004-09-20 Matt Austern <austern@apple.com> Zack Weinberg <zack@codesourcery.com> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d7e5903..4d77a8d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7007,11 +7007,12 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) single bad template instantiation. */ if (complain & tf_error #ifdef USE_MAPPED_LOCATION - && last_loc != input_location) + && last_loc != input_location #else && (last_loc.line != input_line - || last_loc.file != input_filename)) + || last_loc.file != input_filename) #endif + ) { if (TREE_CODE (type) == VOID_TYPE) error ("forming reference to void"); @@ -7323,11 +7324,23 @@ tsubst_baselink (tree baselink, tree object_type, } name = DECL_NAME (get_first_fn (fns)); baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1); + + /* If lookup found a single function, mark it as used at this + point. (If it lookup found multiple functions the one selected + later by overload resolution will be marked as used at that + point.) */ + if (BASELINK_P (baselink)) + fns = BASELINK_FUNCTIONS (baselink); + if (!template_id_p && !really_overloaded_fn (fns)) + mark_used (OVL_CURRENT (fns)); + + /* Add back the template arguments, if present. */ if (BASELINK_P (baselink) && template_id_p) BASELINK_FUNCTIONS (baselink) = build_nt (TEMPLATE_ID_EXPR, BASELINK_FUNCTIONS (baselink), template_args); + if (!object_type) object_type = current_class_type; return adjust_result_of_qualified_name_lookup (baselink, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6bfa3e8..2d2e5b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-09-20 Mark Mitchell <mark@codesourcery.com> + + PR c++/17530 + * g++.dg/template/static7.C: New test. + 2004-09-20 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/17558 diff --git a/gcc/testsuite/g++.dg/template/static7.C b/gcc/testsuite/g++.dg/template/static7.C new file mode 100644 index 0000000..edb8e6a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/static7.C @@ -0,0 +1,16 @@ +// PR c++/17530 +// { dg-do link } + +typedef void (*Func) (); +void f (Func) {} +struct B +{ + static void staticfunc () {} +}; +template <int> +void C(){ f (B::staticfunc); } +int main () +{ + C<0>(); + return 0; +} |