public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67934] New: [concepts] ICE when providing default function implementations using concepts
@ 2015-10-12 14:24 michel.steuwer at gmail dot com
  2015-10-12 14:40 ` [Bug c++/67934] " trippels at gcc dot gnu.org
  2021-11-12  0:00 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: michel.steuwer at gmail dot com @ 2015-10-12 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67934

            Bug ID: 67934
           Summary: [concepts] ICE when providing default function
                    implementations using concepts
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michel.steuwer at gmail dot com
  Target Milestone: ---

Created attachment 36483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36483&action=edit
Contains test case with preprocessed file.

The following code fails with an ICE:

===
#include <iostream>

template <typename T>
concept bool
JustEqualityComparable() {
  return requires(T a, T b) {
    { a == b } -> bool;
  };
}

template <typename T>
concept bool
JustInequalityComparable() {
  return requires(T a, T b) {
    { a != b } -> bool;
  };
}

bool operator==(const JustInequalityComparable& a1,
                const JustInequalityComparable& a2) {
  return !(a1 != a2);
}

bool operator!=(const JustEqualityComparable& a1,
                const JustEqualityComparable& a2) {
  return !(a1 == a2);
}

template <typename T>
  requires JustEqualityComparable<T>()
bool useEq(T t1, T t2) {
  return t1 == t2;
}

struct A {
  int a;
};

bool operator==(const A& a1, const A& a2) {
  return a1.a == a2.a;
}

int main() {
  using namespace std;

  cout << boolalpha << useEq(A{4}, A{6}) << "\n";

  return 0;
}

===
~/bin/gcc/bin/g++ -std=c++1z -save-temps foo.cpp
g++: internal compiler error: Segmentation fault (program cc1plus)


Removing either the operator in line 19 or 24 makes the program compile.
Replacing the operator implemented with concepts in line 19 by a plain template
version makes the program compile as well.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/67934] [concepts] ICE when providing default function implementations using concepts
  2015-10-12 14:24 [Bug c++/67934] New: [concepts] ICE when providing default function implementations using concepts michel.steuwer at gmail dot com
@ 2015-10-12 14:40 ` trippels at gcc dot gnu.org
  2021-11-12  0:00 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-10-12 14:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67934

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-12
                 CC|                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
It is a stack overflow. Could be a dup of PR67595.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/67934] [concepts] ICE when providing default function implementations using concepts
  2015-10-12 14:24 [Bug c++/67934] New: [concepts] ICE when providing default function implementations using concepts michel.steuwer at gmail dot com
  2015-10-12 14:40 ` [Bug c++/67934] " trippels at gcc dot gnu.org
@ 2021-11-12  0:00 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-12  0:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67934

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 81717.

PR 81717#c2 explains the same behavior here.

*** This bug has been marked as a duplicate of bug 81717 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-12  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 14:24 [Bug c++/67934] New: [concepts] ICE when providing default function implementations using concepts michel.steuwer at gmail dot com
2015-10-12 14:40 ` [Bug c++/67934] " trippels at gcc dot gnu.org
2021-11-12  0:00 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).