From: Jakub Jelinek Date: Mon, 18 Jul 2016 18:42:24 +0000 (+0200) Subject: re PR c++/71826 (ICE on valid C++ code with ambiguous member lookup: tree check:... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a7f16ca45487c0a414c9a3d06423ab80d0f6a4f;p=gcc.git re PR c++/71826 (ICE on valid C++ code with ambiguous member lookup: tree check: expected baselink, have error_mark in tsubst_baselink, at cp/pt.c:13737) PR c++/71826 * pt.c (tsubst_baselink): Only set BASELINK_OPTYPE for BASELINK_P. * g++.dg/template/pr71826.C: New test. From-SVN: r238441 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3cd6b133869..899b2aeb656 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-07-18 Jakub Jelinek + PR c++/71826 + * pt.c (tsubst_baselink): Only set BASELINK_OPTYPE for BASELINK_P. + PR c++/71822 * cp-gimplify.c (cp_gimplify_expr) : Recursively fold *expr_p before genericizing it. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1fbf546aaf2..916fd7b47c4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13767,7 +13767,8 @@ tsubst_baselink (tree baselink, tree object_type, BASELINK_FUNCTIONS (baselink), template_args); /* Update the conversion operator type. */ - BASELINK_OPTYPE (baselink) = optype; + if (BASELINK_P (baselink)) + BASELINK_OPTYPE (baselink) = optype; if (!object_type) object_type = current_class_type; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f6471a6c6b..060fcebbf01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-07-18 Jakub Jelinek + PR c++/71826 + * g++.dg/template/pr71826.C: New test. + PR c++/71822 * g++.dg/template/defarg21.C: New test. diff --git a/gcc/testsuite/g++.dg/template/pr71826.C b/gcc/testsuite/g++.dg/template/pr71826.C new file mode 100644 index 00000000000..753fd7e14ce --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr71826.C @@ -0,0 +1,17 @@ +// PR c++/71826 +// { dg-do compile } + +template struct A { int i; }; // { dg-message "note" } +struct B { void i () {} }; // { dg-message "note" } +template struct C : A , B +{ + void f () { i (); } // { dg-error "is ambiguous" } +}; + +int +main () +{ + C c; + c.f (); + return 0; +}