[Bug c++/88355] [c++20] Placeholder non-type template argument type deduction fails with custom types

2020-12-09 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88355

Emmanuel Le Trong  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Emmanuel Le Trong  ---
This bug has disappeared, both tests above compile with version 10.0.0
20200108.

[Bug c++/98216] New: [C++20] std::array template parameter error with negative values

2020-12-09 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Bug ID: 98216
   Summary: [C++20] std::array template parameter error
with negative values
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: emmanuel.le-tr...@cnrs-orleans.fr
  Target Milestone: ---

Sorry for the bad title, I can't figure out how to summarize this:

#include 
#include 

using
an_array = std::array ;

constexpr auto
add_array (an_array a, an_array const& b)
{
a[0] += b[0];
return a;
}

template 
struct
wrapper
{
static constexpr auto
arr = A;
};


template 
auto
add (wrapper  const&, wrapper  const&)
{
return wrapper  {};
}

constexpr auto ONE   = an_array {{  1. }};
constexpr auto MINUS_ONE = an_array {{ -1. }}; 
constexpr auto MINUS_TWO = an_array {{ -2. }}; 

int
main ()
{
auto a = wrapper  {};
auto b = wrapper  {};
auto c = add (a, b);
assert (c.arr == MINUS_TWO); // <- should fail
assert (c.arr == MINUS_ONE); // <- should pass
}

Compiled with version 11.0.0 20201209, the first assertion passes and the
second fails. It should be the opposite.

FWIW, if you replace double by float, it works as intended.

[Bug c++/98216] [C++20] std::array template parameter error with negative values

2020-12-10 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

--- Comment #4 from Emmanuel Le Trong  ---
Looking at the symbols in your snippet:

$ nm -C toto | grep wrapper
00402030 u wrapper::arr

That looks like a weird NaN to me.

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-09-24 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Emmanuel Le Trong  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #9 from Emmanuel Le Trong  ---
Fixed, thank you.

[Bug c++/101945] New: [C++] ICE on recursive atomic constraint

2021-08-17 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101945

Bug ID: 101945
   Summary: [C++] ICE on recursive atomic constraint
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: emmanuel.le-tr...@cnrs-orleans.fr
  Target Milestone: ---

This code

#include 

template 
struct
wrapper
{
T value;
};

template 
requires std::equality_comparable_with 
constexpr bool
operator == (wrapper  const& a, wrapper  const& b)
{
return a.value == b.value;
}
template 
requires std::equality_comparable_with 
constexpr bool
operator == (wrapper  const& a, U const& b)
{
return a.value == b;
}
template 
requires std::equality_comparable_with 
constexpr bool
operator == (T const& a, wrapper  const& b)
{
return a == b.value;
}

constexpr auto
a = wrapper  { 2 };
constexpr auto
b = a;

static_assert (a == b);

int main () {}

compiled with (gcc (GCC) 12.0.0 20210816 (experimental))

g++ -std=c++2a -Wall -Wextra test.cpp

produces an error about an atomic constraint dependent on itself, and an ICE.

Removing the requires clauses, it compiles just fine.

[Bug c++/101945] [C++] ICE on recursive atomic constraint

2021-08-17 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101945

--- Comment #1 from Emmanuel Le Trong  ---
Sorry for the weird indentation, here it is fixed:

#include 

template  struct wrapper
{
T value;
};

template 
requires std::equality_comparable_with 
constexpr bool operator == (wrapper  const& a, wrapper  const& b)
{
return a.value == b.value;
}
template 
requires std::equality_comparable_with 
constexpr bool operator == (wrapper  const& a, U const& b)
{
return a.value == b;
}
template 
requires std::equality_comparable_with 
constexpr bool operator == (T const& a, wrapper  const& b)
{
return a == b.value;
}

constexpr auto a = wrapper  { 2 };
constexpr auto b = a;

static_assert (a == b);

int main () {}