[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

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

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

https://gcc.gnu.org/g:62d60246e53778db6ee613377dd013ba4b264968

commit r11-7992-g62d60246e53778db6ee613377dd013ba4b264968
Author: Jason Merrill 
Date:   Mon Apr 5 11:34:48 2021 -0400

c++: lambda in DMI in class template [PR95870]

Here enclosing_instantiation_of was failing to find a match because otctx
is
struct S and current_function_decl is S::S(), so the latter has
more
function contexts, and we end up trying to compare S() to NULL_TREE.

After spending a bit of time working on establishing the correspondence in
this case (class <=> constructor), it occurred to me that we could just use
DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
redeclared.  Since we're so close to release, for now I'm only doing this
for the case that was failing before.

gcc/cp/ChangeLog:

PR c++/95870
* pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION
if
there is no enclosing non-lambda function.

gcc/testsuite/ChangeLog:

PR c++/95870
* g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

2021-04-05 Thread viktor.rosendahl at bmw dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #7 from Viktor Rosendahl  ---
Thanks for your message. I am on vacation. I will be working again on 6th of
April 2021.

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

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

Jason Merrill  changed:

   What|Removed |Added

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

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

2021-03-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #6 from Marek Polacek  ---
Valid test from bug 97372:

class Lockable {
public:
  Lockable(int *);
};
template  class ThreadTask2 {
  Lockable _state_mutex{[]() -> int * { static int srcloc; return 0; }()};
public:
  ThreadTask2() {}
};
void x() { ThreadTask2 foo; }

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

2021-03-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek  changed:

   What|Removed |Added

 CC||public at enkore dot de

--- Comment #5 from Marek Polacek  ---
*** Bug 97372 has been marked as a duplicate of this bug. ***

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

2020-10-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c

2020-06-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |8.5
   Keywords||ice-on-valid-code
Summary|ICE(segmentation fault) in  |[8/9/10/11 Regression] ICE
   |most_general_template(), in |(segmentation fault) in
   |gcc/cp/pt.c |most_general_template(), in
   ||gcc/cp/pt.c

--- Comment #4 from Marek Polacek  ---
Valid code that ICEs:

template  struct S {
  S();
  int b = []() -> int { enum E {}; return 1; }();
};
struct C : S {
  C();
};
template  S::S() = default;
C::C() {}