[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2019-03-25 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

--- Comment #5 from Jason Merrill  ---
Author: jason
Date: Mon Mar 25 18:27:08 2019
New Revision: 269921

URL: https://gcc.gnu.org/viewcvs?rev=269921=gcc=rev
Log:
PR c++/87748 - substitution failure error with decltype.

This issue is similar to PR 87480; in both cases we were doing non-dependent
substitution with processing_template_decl set, leading to member access
expressions seeming still instantiation-dependent, and therefore decltype
not being simplified to its actual type.  And as in that PR, the fix is to
clear processing_template_decl while substituting a default template
argument.

* pt.c (most_specialized_partial_spec): Clear
processing_template_decl.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/sfinae64.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2019-03-20 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

--- Comment #4 from Jason Merrill  ---
Author: jason
Date: Wed Mar 20 20:31:40 2019
New Revision: 269826

URL: https://gcc.gnu.org/viewcvs?rev=269826=gcc=rev
Log:
PR c++/87480 - decltype of member access in default template arg

The issue here is that declval().d is considered instantiation-dependent
within a template, as the access to 'd' might depend on the particular
specialization.  But when we're deducing template arguments for a call, we
know that the call and the arguments are non-dependent, so we can do the
substitution as though we aren't in a template.  Which strictly speaking we
aren't, since the default argument is considered a separate definition.

* pt.c (type_unification_real): Accept a dependent result in
template context.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2019-03-18 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2019-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.3 |8.4

--- Comment #3 from Jakub Jelinek  ---
GCC 8.3 has been released.

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2018-12-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2018-10-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|--- |8.3

--- Comment #2 from Jonathan Wakely  ---
Slightly further reduced (it happens for any function template, not just
constructors):

template T&& declval();

template ().d)> void f(T) { }

struct A {
  double d;
};

#ifndef FIX
template 
#endif
void j(A& a) {
  f(a);
}

[Bug c++/87480] [8/9 Regression] SFINAE constructor not matched, only in templated function

2018-10-01 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87480

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||7.3.0
   Keywords||rejects-valid
   Last reconfirmed||2018-10-01
 CC||jason at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|SFINAE constructor not  |[8/9 Regression] SFINAE
   |matched, only in templated  |constructor not matched,
   |function|only in templated function
  Known to fail||8.2.0, 9.0

--- Comment #1 from Jonathan Wakely  ---
Confirmed. Started to be rejected with r258039

PR c++/84489 - dependent default template argument

* pt.c (type_unification_real): Handle early substitution failure.