[Bug c++/86747] [8 Regression] rejects-valid with redundant friend declaration
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 26 04:24:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86747
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:3d99aab56d7237bb8260653ed07ca8b182fbf975
commit r8-10073-g3d99aab56d7237bb8260653ed07ca8b182fbf975
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Feb 25 21:29:03 2020 -0500
c++: tsubst friend tpl ctxt before looking it up for dupes [PR86747]
When a member template is redeclared as a friend, we enter the context
of the member before looking it up, and then we check that the decls
are compatible. However, when the member template references template
types of the enclosing context, say an enclosing template class, the
compare fails because the friend decl is already tsubsted, whereas the
looked up name isn't.
The problem is that the enclosing context is taken from the friend
declaration before tsubsting it, so we look up in the context of the
generic template instead of that of the tsubsted one we're
specializing. The solution is to tsubst the enclosing context when
it's a non-namespace scope.
gcc/cp/ChangeLog
2020-02-25 Alexandre Oliva <aoliva@redhat.com>
PR c++/86747
* pt.c (tsubst_friend_class): Enter tsubsted class context.
gcc/testsuite/ChangeLog
2020-02-25 Alexandre Oliva <aoliva@redhat.com>
PR c++/86747
* g++.dg/pr86747.C: New.
More information about the Gcc-bugs
mailing list