From: Jason Merrill Date: Thu, 28 Feb 2013 16:01:09 +0000 (-0500) Subject: re PR c++/56243 (ICE in tree check: expected field_decl, have identifier_node in... X-Git-Tag: upstream/12.2.0~71069 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c966f2deb7d1b4427e8f9c3a94f50e7d98887ac0;p=platform%2Fupstream%2Fgcc.git re PR c++/56243 (ICE in tree check: expected field_decl, have identifier_node in fixed_type_or_null, at cp/class.c:6645) PR c++/56243 * call.c (build_over_call): Avoid virtual lookup in a template. From-SVN: r196343 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a0e7405..90110de 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-02-28 Jason Merrill + + PR c++/56243 + * call.c (build_over_call): Avoid virtual lookup in a template. + 2013-02-27 Jason Merrill PR c++/56358 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 7c41421..4eb38ec 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7033,7 +7033,10 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) if (!already_used) mark_used (fn); - if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0) + if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0 + /* Don't mess with virtual lookup in fold_non_dependent_expr; virtual + functions can't be constexpr. */ + && !in_template_function ()) { tree t; tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (argarray[0])), diff --git a/gcc/testsuite/g++.dg/template/virtual4.C b/gcc/testsuite/g++.dg/template/virtual4.C new file mode 100644 index 0000000..a2c7420b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/virtual4.C @@ -0,0 +1,30 @@ +// PR c++/56243 + +struct A +{ + virtual int String (); +}; + +struct F: A { }; + +struct G +{ + F value; +}; + +struct D +{ + template + void Verify() + { + G x; + F& name = x.value; + name.String(); + } +}; + +int main() +{ + D d; + d.Verify<42>(); +}