public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept
@ 2021-04-27 10:54 f.b.brokken at rug dot nl
  2021-04-28 21:29 ` [Bug c++/100288] [11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: f.b.brokken at rug dot nl @ 2021-04-27 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100288
           Summary: g++-11 internal error and fails to precompile a
                    concept
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.b.brokken at rug dot nl
  Target Milestone: ---

Created attachment 50687
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50687&action=edit
The compiler generated a-bug.ii file

This bug report is using:

g++ (Debian 11-20210424-1) 11.0.1 20210424 (prerelease) [gcc-11 revision
7a7fc01b9d2:ab3797fc424:5b2ac9b40c325e9209c0bd55955db84aad4a0cc5]


On a Debian Linux system, running bullseye (testing) where the latest g++
compiler is the one mentioned above.

The following input was processed by the compiler. The source file 
(named 'bug.h') shown between the ----- lines is precompiled using the command:

    g++ --std=c++2a -Wall -O2 -fdiagnostics-color=never -x c++-header bug.h

The precompilation fails in some cases when using the concept
OstreamInsertable. Specific comment and notes are added beyond the
following 'bug.h' source file.

If you need any additional information, please contact me.

The bug.h source file:
----------------------------------------------------------------------------
#ifndef INCLUDED_CSVTABINS_
#define INCLUDED_CSVTABINS_

// #include <ostream> instead of iosfwd makes no difference
#include <iosfwd>

template <typename Type>
concept OstreamInsertable = 
    requires(std::ostream &out, Type value)
    {
        out << value;
    };

// when using typename instead of the above concept : no error    (1)
// e.g., by activating the following #define
//#define OstreamInsertable typename

struct FMT
{
    enum Align
    {};

    typedef FMT (*FMTFun)(unsigned, unsigned);
    typedef FMT (*FMTHline)(unsigned);
};

class CSVTabIns
{
    template <OstreamInsertable Type>
    friend void operator<<(CSVTabIns &tab, Type const &value);    

// when omitted: results in bugreport1                              (2)
    friend CSVTabIns &operator<<(CSVTabIns &tab, FMT const &fmt);       

    friend void operator<<(CSVTabIns &tab, FMT::FMTHline);        
};

// when defined here: precompilation error                          (3)
// template <OstreamInsertable Type>
inline void operator<<(CSVTabIns &&tab, Type const &value)
{}

inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
{
    // when the insertion is omitted: no precompilation error
    tab << (*hline)(1);      // insert hline in the next column
}

// when defined here: no precompilation error                       (4)
//template <OstreamInsertable Type>
//inline void operator<<(CSVTabIns &&tab, Type const &value)
//{}

#endif
-----------------------------------------------------------------------


At (1): when using 'typename' instead of the 'OstreamInsertable' the
    precompilation completes flawlessly. In that case (2) may either be kept
    or commented out, (3) is used, (4) is commented out

In the following cases the '#define OstreamInsertable typename' was commented
out, resulting in:


At (2): the friend declaration was kept:

    (3) was commented out, (4) was activated: precompilation completed
        flawlessly 

    (3) was kept, (4) was commented out: results in a precompilation error,
        but the error message is (at least for me) not very helpful:

bug.h:11:13:   required by substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&, const Type&) [with Type =
FMT]’
bug.h:46:22:   required from here
bug.h:8:9:   required for the satisfaction of ‘OstreamInsertable<Type>’ [with
Type = FMT]
bug.h:9:5:   in requirements with ‘std::ostream& out’, ‘Type value’ [with Type
= FMT]
bug.h:9:5: error: satisfaction of atomic constraint ‘requires(std::ostream&
out, Type value) {out << value;} [with Type = Type]’ depends on itself
    9 |     requires(std::ostream &out, Type value)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   10 |     {
      |     ~
   11 |         out << value;
      |         ~~~~~~~~~~~~~
   12 |     };
      |     ~


At (2): when the friend declaration is commented out:

    (3) was commented out, (4) was activated: results in a precompilation
error:

bug.h: In function ‘void operator<<(CSVTabIns&, FMT::FMTHline)’:
bug.h:46:9: error: no match for ‘operator<<’ (operand types are ‘CSVTabIns’ and
‘FMT’)
   46 |     tab << (*hline)(1);      // insert hline in the next column
      |     ~~~ ^~ ~~~~~~~~~~~
      |     |              |
      |     CSVTabIns      FMT
bug.h:30:17: note: candidate: ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&, const Type&)’
   30 |     friend void operator<<(CSVTabIns &tab, Type const &value);
      |                 ^~~~~~~~
bug.h:30:17: note:   template argument deduction/substitution failed:
bug.h:30:17: note: constraints not satisfied
bug.h: In substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&, const Type&) [with Type =
FMT]’:
bug.h:46:22:   required from here
bug.h:8:9:   required for the satisfaction of ‘OstreamInsertable<Type>’ [with
Type = FMT]
bug.h:9:5:   in requirements with ‘std::ostream& out’, ‘Type value’ [with Type
= FMT]
bug.h:11:13: note: the required expression ‘(out << value)’ is invalid
   11 |         out << value;
      |         ~~~~^~~~~~~~
cc1plus: note: set ‘-fconcepts-diagnostics-depth=’ to at least 2 for more
detail
bug.h:43:13: note: candidate: ‘void operator<<(CSVTabIns&, FMT::FMTHline)’
   43 | inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
      |             ^~~~~~~~
bug.h:43:54: note:   no known conversion for argument 2 from ‘FMT’ to
‘FMT::FMTHline’ {aka ‘FMT (*)(unsigned int)’}
   43 | inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
      |                                        ~~~~~~~~~~~~~~^~~~~


    (3) was kept, (4) was commented out: results in a compiler bugreport
requesting me to submit the bug-report. The bugreport is:


bug.h: In substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&&, const Type&) [with Type =
FMT]’:
bug.h:11:13:   required by substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&, const Type&) [with Type =
FMT]’
bug.h:46:22:   required from here
bug.h:8:9:   required for the satisfaction of ‘OstreamInsertable<Type>’ [with
Type = FMT]
bug.h:9:5:   in requirements with ‘std::ostream& out’, ‘Type value’ [with Type
= FMT]
bug.h:9:5: error: satisfaction of atomic constraint ‘requires(std::ostream&
out, Type value) {out << value;} [with Type = Type]’ depends on itself
    9 |     requires(std::ostream &out, Type value)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   10 |     {
      |     ~
   11 |         out << value;
      |         ~~~~~~~~~~~~~
   12 |     };
      |     ~
bug.h: In function ‘void operator<<(CSVTabIns&, FMT::FMTHline)’:
bug.h:46:9: error: no match for ‘operator<<’ (operand types are ‘CSVTabIns’ and
‘FMT’)
   46 |     tab << (*hline)(1);      // insert hline in the next column
      |     ~~~ ^~ ~~~~~~~~~~~
      |     |              |
      |     CSVTabIns      FMT
bug.h:40:13: note: candidate: ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&&, const Type&)’
   40 | inline void operator<<(CSVTabIns &&tab, Type const &value)
      |             ^~~~~~~~
bug.h:40:13: note:   template argument deduction/substitution failed:
bug.h:40:13: note: constraints not satisfied
bug.h: In substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&&, const Type&) [with Type =
FMT]’:
bug.h:11:13:   required by substitution of ‘template<class Type>  requires 
OstreamInsertable<Type> void operator<<(CSVTabIns&&, const Type&) [with Type =
FMT]’
bug.h:46:22:   required from here
bug.h:8:9:   required for the satisfaction of ‘OstreamInsertable<Type>’ [with
Type = FMT]
bug.h:9:5:   in requirements with ‘std::ostream& out’, ‘Type value’ [with Type
= FMT]
bug.h:11:13: internal compiler error: in get, at cp/constraint.cc:2666
   11 |         out << value;
      |         ~~~~^~~~~~~~
0xc73b0f satisfaction_cache::get()
    ../../src/gcc/cp/constraint.cc:2666
0xc79264 satisfy_atom
    ../../src/gcc/cp/constraint.cc:2942
0xc79264 satisfy_constraint_r
    ../../src/gcc/cp/constraint.cc:3047
0xc797aa satisfy_normalized_constraints
    ../../src/gcc/cp/constraint.cc:3072
0xc79a24 satisfy_declaration_constraints
    ../../src/gcc/cp/constraint.cc:3280
0xc79a24 constraint_satisfaction_value
    ../../src/gcc/cp/constraint.cc:3300
0x9f6743 constraints_satisfied_p(tree_node*, tree_node*)
    ../../src/gcc/cp/constraint.cc:3337
0x9f6743 constraints_satisfied_p(tree_node*, tree_node*)
    ../../src/gcc/cp/constraint.cc:3331
0x9f6743 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
    ../../src/gcc/cp/pt.c:21686
0x16e0aa9 add_template_candidate_real(z_candidate**, tree_node*, tree_node*,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed> const*, tree_node*,
tree_node*, tree_node*, int, tree_node*, unification_kind_t, int) [clone
.isra.0]
    ../../src/gcc/cp/call.c:3456
0x14bd4d6 add_template_candidate
    ../../src/gcc/cp/call.c:3541
0x14bd4d6 add_candidates
    ../../src/gcc/cp/call.c:6031
0x15dee95 add_operator_candidates
    ../../src/gcc/cp/call.c:6153
0x14bddbc build_new_op_1
    ../../src/gcc/cp/call.c:6376
0x14bc9d3 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
    ../../src/gcc/cp/call.c:6764
0x14bc9d3 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
    ../../src/gcc/cp/typeck.c:4323
0x154d551 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../src/gcc/cp/pt.c:19919
0x15d5be7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
    ../../src/gcc/cp/pt.c:19198
0x1325a15 tsubst_valid_expression_requirement(tree_node*, tree_node*, sat_info)
[clone .isra.0]
    ../../src/gcc/cp/constraint.cc:1959
0xc7829a tsubst_simple_requirement
    ../../src/gcc/cp/constraint.cc:1993
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
@ 2021-04-28 21:29 ` mpolacek at gcc dot gnu.org
  2021-04-28 22:03 ` mpolacek at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-28 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.2
   Last reconfirmed|                            |2021-04-28
            Summary|g++-11 internal error and   |[11/12 Regression] g++-11
                   |fails to precompile a       |internal error and fails to
                   |concept                     |precompile a concept
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I see an ICE with -std=c++20 starting with r11-6245.  The test seems invalid.

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
  2021-04-28 21:29 ` [Bug c++/100288] [11/12 Regression] " mpolacek at gcc dot gnu.org
@ 2021-04-28 22:03 ` mpolacek at gcc dot gnu.org
  2021-04-29 16:13 ` ppalka at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-28 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Reduced test that shows the ICE:

class ostream;
template <typename Type>
concept OstreamInsertable = requires(ostream out, Type value) {
  out << value;
};
struct FMT {};
class CSVTabIns {
  template <OstreamInsertable Type> friend void operator<<(CSVTabIns, Type);
};
template <OstreamInsertable Type> void operator<<(CSVTabIns, Type &);
void operator<<(CSVTabIns tab, FMT) {
  tab << 1;
}

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
  2021-04-28 21:29 ` [Bug c++/100288] [11/12 Regression] " mpolacek at gcc dot gnu.org
  2021-04-28 22:03 ` mpolacek at gcc dot gnu.org
@ 2021-04-29 16:13 ` ppalka at gcc dot gnu.org
  2021-05-01 18:22 ` ppalka at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-29 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (2 preceding siblings ...)
  2021-04-29 16:13 ` ppalka at gcc dot gnu.org
@ 2021-05-01 18:22 ` ppalka at gcc dot gnu.org
  2021-05-01 20:31 ` f.b.brokken at rug dot nl
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-01 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=99599

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Agreed, the testcase looks invalid much like PR99599.  One workaround for
avoiding the constraint recursion here would be to change the signature of

  template <OstreamInsertable Type>
  inline void operator<<(CSVTabIns &&tab, Type const &value)

to something like

  template <std::same_as<std::remove_cvref_t<CSVTabIns>> U, OstreamInsertable
Type>
  inline void operator<<(U &&tab, Type const &value)

so that the constraint OstreamInsertable<Type> is checked on this overload only
if the first argument to << has the expected type.

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (3 preceding siblings ...)
  2021-05-01 18:22 ` ppalka at gcc dot gnu.org
@ 2021-05-01 20:31 ` f.b.brokken at rug dot nl
  2021-05-03 14:01 ` ppalka at gcc dot gnu.org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: f.b.brokken at rug dot nl @ 2021-05-01 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Frank B. Brokken <f.b.brokken at rug dot nl> ---
Dear ppalka at gcc dot gnu.org, you wrote:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100288
> 
> Patrick Palka <ppalka at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Keywords|                            |ice-on-invalid-code
>            See Also|                            |https://gcc.gnu.org/bugzill
>                    |                            |a/show_bug.cgi?id=99599
> 
> --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
> Agreed, the testcase looks invalid much like PR99599.  One workaround for
> avoiding the constraint recursion here would be to change the signature of
> 
>   template <OstreamInsertable Type>
>   inline void operator<<(CSVTabIns &&tab, Type const &value)
> 
> to something like
> 
>   template <std::same_as<std::remove_cvref_t<CSVTabIns>> U, OstreamInsertable
> Type>
>   inline void operator<<(U &&tab, Type const &value)
> 
> so that the constraint OstreamInsertable<Type> is checked on this overload only
> if the first argument to << has the expected type.
> 
> -- 
> You are receiving this mail because:
> You reported the bug.

Hi Patrick,

Thanks for your e-mail.

Since (AFAICS) you directly and only sent your e-mail to me I'm wondering
whether you want me to comment on your e-mail. It's getting kind of late here,
but I could send a more extensive reply tomorrow. Let me know if that's what
you want.

I tried your suggestion, and it seems to solve the issue. But at the same time
it puzzles me why 

    template <OstreamInsertable Type>
    inline void operator<<(CSVTabIns &&tab, Type const &value)
    {}

won't be instantiated for FMT in

    inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
    {
        tab << (*hline)(1);      // insert hline in the next column
    }

when FMT defines FMTHline as  'typedef FMT (*FMTHline)(unsigned)' and 

    std::ostream &operator<<(std::ostream &out, FMT const &fmt)

is declared. I would have expected that 

        tab << (*hline)(1);      // insert hline in the next column

would cause the compiler to instantiate 

    template <OstreamInsertable Type>
    inline void operator<<(CSVTabIns &&tab, Type const &value)
    {}

for Type = FMT.

Maybe I'm missing something here? And it's also not something that caused the
compiler's internal error.

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (4 preceding siblings ...)
  2021-05-01 20:31 ` f.b.brokken at rug dot nl
@ 2021-05-03 14:01 ` ppalka at gcc dot gnu.org
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-03 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Frank B. Brokken from comment #4)
> Dear ppalka at gcc dot gnu.org, you wrote:
> > 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100288
> > 
> > Patrick Palka <ppalka at gcc dot gnu.org> changed:
> > 
> >            What    |Removed                     |Added
> > ----------------------------------------------------------------------------
> >            Keywords|                            |ice-on-invalid-code
> >            See Also|                            |https://gcc.gnu.org/bugzill
> >                    |                            |a/show_bug.cgi?id=99599
> > 
> > --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
> > Agreed, the testcase looks invalid much like PR99599.  One workaround for
> > avoiding the constraint recursion here would be to change the signature of
> > 
> >   template <OstreamInsertable Type>
> >   inline void operator<<(CSVTabIns &&tab, Type const &value)
> > 
> > to something like
> > 
> >   template <std::same_as<std::remove_cvref_t<CSVTabIns>> U, OstreamInsertable
> > Type>
> >   inline void operator<<(U &&tab, Type const &value)
> > 
> > so that the constraint OstreamInsertable<Type> is checked on this overload only
> > if the first argument to << has the expected type.
> > 
> > -- 
> > You are receiving this mail because:
> > You reported the bug.
> 
> Hi Patrick,
> 
> Thanks for your e-mail.
> 
> Since (AFAICS) you directly and only sent your e-mail to me I'm wondering
> whether you want me to comment on your e-mail. It's getting kind of late
> here,
> but I could send a more extensive reply tomorrow. Let me know if that's what
> you want.

Oh sorry, that was just an automated email for the comment I posted to the
bugzilla PR, which gets sent to everyone on the CC list of the PR.  I wasn't
expecting any sort of reply :)

> 
> I tried your suggestion, and it seems to solve the issue. But at the same
> time
> it puzzles me why 
> 
>     template <OstreamInsertable Type>
>     inline void operator<<(CSVTabIns &&tab, Type const &value)
>     {}
> 
> won't be instantiated for FMT in
> 
>     inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
>     {
>         tab << (*hline)(1);      // insert hline in the next column
>     }
> 
> when FMT defines FMTHline as  'typedef FMT (*FMTHline)(unsigned)' and 
> 
>     std::ostream &operator<<(std::ostream &out, FMT const &fmt)
> 
> is declared. I would have expected that 
> 
>         tab << (*hline)(1);      // insert hline in the next column
> 
> would cause the compiler to instantiate 
> 
>     template <OstreamInsertable Type>
>     inline void operator<<(CSVTabIns &&tab, Type const &value)
>     {}
> 
> for Type = FMT.
> 


The compiler does try to instantiate that overload for Type = FMT there, but
when checking the constraint OstreamInsertable<FMT> on this overload it needs
to resolve the << in

    requires(std::ostream &out, Type value)
    {
        out << value;
    };

for Type = FMT, during which it considers that same operator<< overload.  And
CWG2369 says we now first check constraints before non-dependent conversions,
but we're in the middle of checking the constraints on this overload, so we
enter a constraint loop.

> Maybe I'm missing something here? And it's also not something that caused the
> compiler's internal error.

Yeah, we shouldn't be seeing an internal error even on an invalid testcase. 
This needs to be fixed.

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (5 preceding siblings ...)
  2021-05-03 14:01 ` ppalka at gcc dot gnu.org
@ 2021-07-28  7:06 ` rguenth at gcc dot gnu.org
  2021-08-17 20:16 ` ppalka at gcc dot gnu.org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (6 preceding siblings ...)
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
@ 2021-08-17 20:16 ` ppalka at gcc dot gnu.org
  2021-11-05 14:01 ` ppalka at gcc dot gnu.org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-17 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emmanuel.le-trong@cnrs-orle
                   |                            |ans.fr

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 101945 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (7 preceding siblings ...)
  2021-08-17 20:16 ` ppalka at gcc dot gnu.org
@ 2021-11-05 14:01 ` ppalka at gcc dot gnu.org
  2022-01-21 12:17 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-11-05 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dangelog at gmail dot com

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 102396 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (8 preceding siblings ...)
  2021-11-05 14:01 ` ppalka at gcc dot gnu.org
@ 2022-01-21 12:17 ` rguenth at gcc dot gnu.org
  2022-04-21  7:49 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/100288] [11/12 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (9 preceding siblings ...)
  2022-01-21 12:17 ` rguenth at gcc dot gnu.org
@ 2022-04-21  7:49 ` rguenth at gcc dot gnu.org
  2022-05-11 15:03 ` [Bug c++/100288] [11/12/13 " ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug c++/100288] [11/12/13 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (10 preceding siblings ...)
  2022-04-21  7:49 ` rguenth at gcc dot gnu.org
@ 2022-05-11 15:03 ` ppalka at gcc dot gnu.org
  2022-05-11 15:04 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-05-11 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for 9.5/10.4/11.3/12.

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

* [Bug c++/100288] [11/12/13 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (11 preceding siblings ...)
  2022-05-11 15:03 ` [Bug c++/100288] [11/12/13 " ppalka at gcc dot gnu.org
@ 2022-05-11 15:04 ` ppalka at gcc dot gnu.org
  2022-09-09 22:22 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-05-11 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #10)
> Fixed for 9.5/10.4/11.3/12.

Whoops, wrong PR...

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

* [Bug c++/100288] [11/12/13 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (12 preceding siblings ...)
  2022-05-11 15:04 ` ppalka at gcc dot gnu.org
@ 2022-09-09 22:22 ` ppalka at gcc dot gnu.org
  2023-03-16 18:23 ` cvs-commit at gcc dot gnu.org
  2023-03-16 18:26 ` ppalka at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-09-09 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hewillk at gmail dot com

--- Comment #12 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 106801 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100288] [11/12/13 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (13 preceding siblings ...)
  2022-09-09 22:22 ` ppalka at gcc dot gnu.org
@ 2023-03-16 18:23 ` cvs-commit at gcc dot gnu.org
  2023-03-16 18:26 ` ppalka at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-16 18:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:c630157fd01140dbce120c1409c413a97dc17104

commit r13-6715-gc630157fd01140dbce120c1409c413a97dc17104
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Mar 16 14:22:54 2023 -0400

    c++: checking ICE with diagnosed constraint recursion [PR100288]

    When satisfaction_cache::get detects constraint recursion, it asserts
    that entry->result is empty.  This makes sense when we're initially
    detecting/diagnosing recursion from the inner recursive call, but
    afterwards from the outer recursive call the recursion error is treated
    like any other unrelated constraint failure encountered during
    satisfaction, and we set entry->result to whatever the satisfaction
    value ended up being.

    Perhaps we should keep entry->result cleared in this case, but that'd
    require the inner recursive call to communicate to the outer recursive
    call that constraint recursion occurred, likely via setting entry->result
    to some sentinel value, which doesn't seem to be worth the complexity.
    So this patch just relaxes the problematic assert to accept non-empty
    entry->result as long as we've already issued an error.

            PR c++/100288

    gcc/cp/ChangeLog:

            * constraint.cc (satisfaction_cache::get): Relax overly strict
            checking assert in the constraint recursion case.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-recursive-sat5.C: New test.

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

* [Bug c++/100288] [11/12/13 Regression] g++-11 internal error and fails to precompile a concept
  2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
                   ` (14 preceding siblings ...)
  2023-03-16 18:23 ` cvs-commit at gcc dot gnu.org
@ 2023-03-16 18:26 ` ppalka at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-16 18:26 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-checking
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|11.4                        |13.0

--- Comment #14 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13, backporting isn't really necessary since the ICE occurs only
in non-release builds.

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

end of thread, other threads:[~2023-03-16 18:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 10:54 [Bug c++/100288] New: g++-11 internal error and fails to precompile a concept f.b.brokken at rug dot nl
2021-04-28 21:29 ` [Bug c++/100288] [11/12 Regression] " mpolacek at gcc dot gnu.org
2021-04-28 22:03 ` mpolacek at gcc dot gnu.org
2021-04-29 16:13 ` ppalka at gcc dot gnu.org
2021-05-01 18:22 ` ppalka at gcc dot gnu.org
2021-05-01 20:31 ` f.b.brokken at rug dot nl
2021-05-03 14:01 ` ppalka at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-08-17 20:16 ` ppalka at gcc dot gnu.org
2021-11-05 14:01 ` ppalka at gcc dot gnu.org
2022-01-21 12:17 ` rguenth at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2022-05-11 15:03 ` [Bug c++/100288] [11/12/13 " ppalka at gcc dot gnu.org
2022-05-11 15:04 ` ppalka at gcc dot gnu.org
2022-09-09 22:22 ` ppalka at gcc dot gnu.org
2023-03-16 18:23 ` cvs-commit at gcc dot gnu.org
2023-03-16 18:26 ` ppalka 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).