[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-06-12 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jason Merrill  ---
Fixed for 8.2.

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-06-11 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

--- Comment #6 from Jason Merrill  ---
Author: jason
Date: Mon Jun 11 22:02:13 2018
New Revision: 261463

URL: https://gcc.gnu.org/viewcvs?rev=261463=gcc=rev
Log:
PR c++/85765 - SFINAE and non-type default template arg.

* pt.c (type_unification_real): Do full semantic processing if
substituting a partial args list replaces all template parms.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg10.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/pt.c

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-06-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

--- Comment #5 from Jason Merrill  ---
Author: jason
Date: Mon Jun  4 13:22:52 2018
New Revision: 261146

URL: https://gcc.gnu.org/viewcvs?rev=261146=gcc=rev
Log:
PR c++/85765 - SFINAE and non-type default template arg.

* pt.c (type_unification_real): Do full semantic processing if
substituting a partial args list replaces all template parms.

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

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-06-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

Jason Merrill  changed:

   What|Removed |Added

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

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-05-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |8.2

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-05-13 Thread Casey at Carter dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

--- Comment #4 from Casey Carter  ---
Narrowing the error down:

template())), decltype(*U(),0) =
0>
U g(T& t, long) { return begin(t); } // #1


prog.cc: In instantiation of 'U g(T&, long int) [with T = volatile il; U =
int*; decltype (((* U()), 0))  = 0]'

The "U = int*" is particularly damning here: it tells us the compiler
substituted `volatile il` into `decltype(begin(declval()))` to get
`begin(declval())`. `int* begin(il);` is a *candidate* for
overload resolution - it has the right name and number of parameters - and it's
a viable candidate because the ICS from lvalue `volatile il` to `il` is an
identity conversion per [over.best.ics]/6: "Any difference in top-level
cv-qualification is subsumed by the initialization itself and does not
constitute a conversion. ... When the parameter has a class type and the
argument expression has the same type, the implicit conversion sequence is an
identity conversion." Since it's the *only* viable function, it is
unambiguously the *best* viable function.

So the only question here is why the compiler omits the final analysis that
would determine that initialization of an `il` from a `volatile il&` is
ill-formed - making the entire function call expression ill-formed - but only
does so when the following `decltype(*U(),0) = 0` is present in the template
parameter list.

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-05-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

--- Comment #3 from Jonathan Wakely  ---
But that patch is also on gcc-7-branch and the testcases work with gcc version
7.3.1 20180419, so there must have been something latent on trunk that was
revealed by that change.

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-05-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

--- Comment #2 from Jonathan Wakely  ---
Those volatile overloads in std::bind are a constant source of problems (most
recently PR 85118).

The regression happened with r258407:

PR c++/84785 - ICE with alias template and default targs.

* pt.c (type_unification_real): Set processing_template_decl if
saw_undeduced == 1.

[Bug c++/85765] [8/9 Regression] Missing SFINAE in default template argument

2018-05-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85765

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-13
  Known to work||7.3.1
Summary|Missing SFINAE in default   |[8/9 Regression] Missing
   |template argument   |SFINAE in default template
   ||argument
 Ever confirmed|0   |1
  Known to fail||8.1.0, 9.0