[Bug libstdc++/102280] span's range deduction guide is missing ranges::contiguous_range constraint

2021-09-20 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102280

--- Comment #4 from Joe Loser  ---
Johnathan, your fix LGTM. Safe to mark this as resolved, or do you need to do
something to backport it for the 10.4 release branch?

[Bug c++/102412] New: Template argument deduction fails when using concept as defaulted non-type template parameter

2021-09-20 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102412

Bug ID: 102412
   Summary: Template argument deduction fails when using concept
as defaulted non-type template parameter
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: rejects-valid
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joeloser93 at gmail dot com
  Target Milestone: ---

When using a defaulted non-type template parameter whose value is from a
concept, GCC is unable to deduce the template correctly when calling the
function template. Clang accepts this code and it should be valid. 

```
#include 

template
concept different_from = not std::is_same_v;

template>
void f() {}

template>
void g() {}

int main() {
f(); // fails to compile
g(); // compiles
}

```

See it live at https://godbolt.org/z/n1zrzGPoq

[Bug c++/102280] span's range deduction guide is missing ranges::contiguous_range constraint

2021-09-10 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102280

--- Comment #2 from Joe Loser  ---
Sorry, typo in previous comment. The `span` range deduction guide should
constrain on `ranges::contiguous_range`, not `contiguous_iterator` concept --
sorry. This is from P1394 (https://wg21.link/p1394).

[Bug c++/102280] span's range deduction guide is missing contiguous_iterator constraint

2021-09-10 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102280

--- Comment #1 from Joe Loser  ---
`span` has a range deduction guide, but it is not properly constrained for
ranges satisfying `contiguous_iterator` concept only at
https://github.com/gcc-mirror/gcc/blob/01b5038718056b024b370b74a874fbd92c5bbab3/libstdc%2B%2B-v3/include/std/span#L412
per 22.7.3.3 in the working draft.

[Bug c++/102280] New: span'

2021-09-10 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102280

Bug ID: 102280
   Summary: span'
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joeloser93 at gmail dot com
  Target Milestone: ---

[Bug c++/101677] [11/12 Regression] Concept with use of incomplete type succeeds on GCC 10.3.0, fails on GCC 11 onward

2021-07-30 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101677

--- Comment #2 from Joe Loser  ---
(In reply to Andrew Pinski from comment #1)
> >This bug can be worked around by using a complete type instead when defining 
> >the concept. 
> 
> It does not even have to be complete type; just defined before.
> So adding:
> class S;
> at the begining causes GCC to accept the code.

Yep, you're right. That's actually what I use in my codebase as a workaround. I
misspoke in the description -- sorry about that. Updated Godbolt link is at
https://godbolt.org/z/KGq48WYq4

[Bug c++/101670] Internal compiler error with concepts

2021-07-29 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101670

Joe Loser  changed:

   What|Removed |Added

 CC||joeloser93 at gmail dot com

--- Comment #1 from Joe Loser  ---
Here's a simple workaround using concepts directly:

```
template  concept Complete = requires(T t) { sizeof(t); };
template  concept Incomplete = !Complete;
template  struct S {};

struct A;
S s1;

struct A {};
S s2;
```



See it live at https://gcc.godbolt.org/z/MjKoM8dP6

[Bug c++/101677] New: [11 Regression] Concept with use of incomplete type succeeds on GCC 10.3.0, fails on GCC 11 onward

2021-07-29 Thread joeloser93 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101677

Bug ID: 101677
   Summary: [11 Regression] Concept with use of incomplete type
succeeds on GCC 10.3.0, fails on GCC 11 onward
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joeloser93 at gmail dot com
  Target Milestone: ---

A concept that uses an incomplete type in testing the well-formedness of
calling a function template is well-formed in GCC 10.3.0, but fails in GCC 11
onward (including trunk at the time of this writing).

For example, consider the following:

template
concept C_bug_with_forward_decl = requires(T& t){
t.template f();
};

struct good {
template auto f() -> void {}
};

static_assert(C_bug_with_forward_decl); // works in GCC 10.3.0, fails on
GCC 11 onward

This bug can be worked around by using a complete type instead when defining
the concept. For example:

struct U{};
template
concept C_workaround = requires(T& t){
t.template f();
};

static_assert(C_workaround); // works on GCC 10.3.0 and GCC 11 onward

See it live at https://godbolt.org/z/h7GzqGhYn