[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2021-04-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:00a2774923c1dc5666cd26bb9b8c37b1b7dd689d

commit r11-8182-g00a2774923c1dc5666cd26bb9b8c37b1b7dd689d
Author: Jason Merrill 
Date:   Wed Apr 14 14:14:31 2021 -0400

c++: premature overload resolution redux [PR100078]

My patch for PR93085 didn't consider that a default template argument can
also make a template dependent.

gcc/cp/ChangeLog:

PR c++/100078
PR c++/93085
* pt.c (uses_outer_template_parms): Also look at default
template argument.

gcc/testsuite/ChangeLog:

PR c++/100078
* g++.dg/template/dependent-tmpl2.C: New test.

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2021-04-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:84081e2c6bd43a6790f751755865cf4227adac7c

commit r11-8137-g84081e2c6bd43a6790f751755865cf4227adac7c
Author: Jason Merrill 
Date:   Sat Apr 10 02:10:32 2021 -0400

c++: premature overload resolution [PR93085]

We can't resolve the call to foo<42> before instantiation of G, because the
template parameter of #1 has dependent type.  But we were missing that in
our dependency check, because the tree walk of DECL_TEMPLATE_PARMS doesn't
look into the types of template parameters.  So look at them directly.

gcc/cp/ChangeLog:

PR c++/93085
* pt.c (uses_outer_template_parms): Handle non-type and template
template parameters specifically.

gcc/testsuite/ChangeLog:

PR c++/93085
* g++.dg/template/dependent-tmpl1.C: New test.

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2021-04-10 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

Jason Merrill  changed:

   What|Removed |Added

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

--- Comment #5 from Jason Merrill  ---
The ICEs are fixed, I want to address the second testcase in comment #3.

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2020-10-17 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

--- Comment #4 from Johel Ernesto Guerrero Peña  ---
> GCC shouldn't even be trying to resolve `foo<42>()` until `G` has been 
> instantiated.

That's right. I came across this bug report when reporting such an issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97476.

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2020-10-17 Thread arthur.j.odwyer at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

--- Comment #3 from Arthur O'Dwyer  ---
Re comment 2: My original test code was "invalid-code", but here's one I
believe to be "valid-code" in C++20.

// https://godbolt.org/z/dqcWeq
template class A>
struct G {
template using B = A;
template static int foo();
template static int foo();
int x = foo<42>();  // OK
};

test.cc:7:21: internal compiler error: in get_class_binding_direct, at
cp/name-lookup.c:1238
7 | int x = foo<42>();  // OK
  | ^


If you change the `` to an ``, the ICE disappears, but GCC still gives a
bogus error at template-definition time:

// https://godbolt.org/z/Tjrnzv
template class A>
struct G {
template using B = A;
template static int foo();// #1
template static int foo();  // #2
int x = foo<42>();  // OK
};

test.cc:7:21: error: call of overloaded 'foo()' is ambiguous
7 | int x = foo<42>();  // OK
  | ^

GCC shouldn't even be trying to resolve `foo<42>()` until `G` has been
instantiated; and once `G` has been instantiated with some specific `A`, this
call may or may not be ambiguous (depending on whether it's possible to deduce
the template arguments to foo #1 or not).

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2020-10-17 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

 CC||johelegp at gmail dot com

--- Comment #2 from Johel Ernesto Guerrero Peña  ---
Invalid because it passes (a) type template argument(s) to a template template
parameter.

[Bug c++/93085] ICE in get_class_binding_direct and alias_ctad_tweaks, with C++20 NTTP + CTAD + alias template

2020-01-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2020-01-21
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, is it a valid code or not?