[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-20 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

Marek Polacek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2024-03-20

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-20 Thread de34 at live dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

Jiang An  changed:

   What|Removed |Added

 CC||de34 at live dot cn

--- Comment #10 from Jiang An  ---
I think this is basically CWG2709
(https://cplusplus.github.io/CWG/issues/2709.html).
Given CWG2709 is closed as NAD, we should reject such initializations.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #9 from Andrew Pinski  ---
https://eel.is/c++draft/dcl.init.general#16.2 applies here I think. Which comes
before the `Parenthesized aggregates initialization` clause. But I could be
wrong.

https://github.com/cplusplus/papers/issues/1494 is kinda of related.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #8 from Andrew Pinski  ---
(In reply to Jonathan Wakely from comment #7)
> All of Clang, MSVC and EDG disagree with GCC though, so maybe there's a DR
> that we're missing.

Maybe https://cplusplus.github.io/CWG/issues/1467.html (again).
See clang bug https://github.com/llvm/llvm-project/pull/77768 .

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #7 from Jonathan Wakely  ---
All of Clang, MSVC and EDG disagree with GCC though, so maybe there's a DR that
we're missing.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #6 from Marek Polacek  ---
Right, another design principle is that () should work where {} works, and
const B {a}; works.  A(b) previously didn't work so it's not really changing
meaning.  So not a bug IMHO.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #5 from Jonathan Wakely  ---
I disagree, A(b) definitely changed meaning. It now initializes A by copying
the base part of b

This is a combination of aggregates being allowed to have base classes and
paren-init doing aggregate-init.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #4 from Andrew Pinski  ---
(In reply to Marek Polacek from comment #3)
> Changed with r10-5137-g43aae289866f5e:
> 
> commit 43aae289866f5ea55d187444520412554aa2e171
> Author: Marek Polacek 
> Date:   Tue Dec 3 15:59:40 2019 +
> 
> PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.

Hmm, reading the paper, I am not 100% sure if GCC implemented this correctly
due to the wording of the design principles:
```
Any existing meaning of A(b) should not change.
```

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
Changed with r10-5137-g43aae289866f5e:

commit 43aae289866f5ea55d187444520412554aa2e171
Author: Marek Polacek 
Date:   Tue Dec 3 15:59:40 2019 +

PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

--- Comment #2 from Andrew Pinski  ---
Except this works with C++20+ for GCC:
```
struct A {
int a;
};
struct B : public A {};

void f(const A )
{
typedef const B & Btype;
Btype b(a);
}

```

[Bug c++/114395] [c++20+] std::is_constructible_v result of const reference incorrect

2024-03-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114395

Andrew Pinski  changed:

   What|Removed |Added

Summary|std::is_constructible_v |[c++20+]
   |result of const reference   |std::is_constructible_v
   |incorrect   |result of const reference
   ||incorrect

--- Comment #1 from Andrew Pinski  ---
Hmm, this fails only for C++20+.