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
This commit is contained in:
Jakub Jelinek 2016-07-18 20:42:24 +02:00 committed by Jakub Jelinek
parent f4d902955b
commit 7a7f16ca45
4 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71826
* pt.c (tsubst_baselink): Only set BASELINK_OPTYPE for BASELINK_P.
PR c++/71822
* cp-gimplify.c (cp_gimplify_expr) <case VEC_INIT_EXPR>: Recursively
fold *expr_p before genericizing it.

View File

@ -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;

View File

@ -1,5 +1,8 @@
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71826
* g++.dg/template/pr71826.C: New test.
PR c++/71822
* g++.dg/template/defarg21.C: New test.

View File

@ -0,0 +1,17 @@
// PR c++/71826
// { dg-do compile }
template <class> struct A { int i; }; // { dg-message "note" }
struct B { void i () {} }; // { dg-message "note" }
template <class T> struct C : A <T>, B
{
void f () { i (); } // { dg-error "is ambiguous" }
};
int
main ()
{
C <int> c;
c.f ();
return 0;
}