public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed
@ 2023-07-05 19:36 blubban at gmail dot com
2023-07-05 23:13 ` [Bug c++/110565] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: blubban at gmail dot com @ 2023-07-05 19:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Bug ID: 110565
Summary: Incomplete note on why initializing int& with int is
ill-formed
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blubban at gmail dot com
Target Milestone: ---
struct X {
X(int&);
X(X&&) = delete; // the issue reproduces without this line, but the error
is clearer with it
};
template<int>
void f() {
new X(0);
}
Expected output:
<source>: In function 'void f()':
<source>:8:12: error: no matching function for call to 'X::X(int)'
8 | new X(0);
| ^
<source>:2:5: note: candidate: 'X::X(int&)' (near match)
2 | X(int&);
| ^
<source>:2:5: note: conversion of argument 1 would be ill-formed:
<source>:8:11: error: cannot bind non-const lvalue reference of type 'int&' to
an rvalue of type 'int'
Actual output:
<source>: In function 'void f()':
<source>:8:12: error: no matching function for call to 'X::X(int)'
8 | new X(0);
| ^
<source>:2:5: note: candidate: 'X::X(int&)' (near match)
2 | X(int&);
| ^
<source>:2:5: note: conversion of argument 1 would be ill-formed:
The template and new-expression are necessary; the error is proper without
them.
https://godbolt.org/z/c1Er5nsjd
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [10/11/12/13/14 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
@ 2023-07-05 23:13 ` pinskia at gcc dot gnu.org
2023-07-06 8:18 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-05 23:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Incomplete note on why |[10/11/12/13/14 Regression]
|initializing int& with int |Incomplete note on why
|is ill-formed |initializing int& with int
| |is ill-formed
Ever confirmed|0 |1
Known to fail| |5.1.0
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-07-05
Known to work| |4.9.4
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 4.9 and before gave a slightly better error message:
<source>: In function 'void f()':
<source>:8:12: error: no matching function for call to 'X::X(int)'
new X(0);
^
<source>:8:12: note: candidate is:
<source>:2:5: note: X::X(int&)
X(int&);
^
<source>:2:5: note: no known conversion for argument 1 from 'int' to 'int&'
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [10/11/12/13/14 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
2023-07-05 23:13 ` [Bug c++/110565] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-07-06 8:18 ` rguenth at gcc dot gnu.org
2023-07-07 10:45 ` [Bug c++/110565] [11/12/13/14 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-06 8:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |13.1.1
Target Milestone|--- |10.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [11/12/13/14 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
2023-07-05 23:13 ` [Bug c++/110565] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-06 8:18 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:45 ` rguenth at gcc dot gnu.org
2024-03-07 23:30 ` law at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [11/12/13/14 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
` (2 preceding siblings ...)
2023-07-07 10:45 ` [Bug c++/110565] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-07 23:30 ` law at gcc dot gnu.org
2024-03-11 14:27 ` redi at gcc dot gnu.org
2024-07-19 13:20 ` [Bug c++/110565] [12/13/14/15 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 23:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
Priority|P3 |P2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [11/12/13/14 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
` (3 preceding siblings ...)
2024-03-07 23:30 ` law at gcc dot gnu.org
@ 2024-03-11 14:27 ` redi at gcc dot gnu.org
2024-07-19 13:20 ` [Bug c++/110565] [12/13/14/15 " rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2024-03-11 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The diagnostic was changed by r5-601-gd02f620dc0bb3b
Author: Jason Merrill
Date: Wed May 14 17:48:07 2014
re PR c++/20332 (poor diagnostic when bind non lvalue to a reference for
default arguments)
PR c++/20332
PR c++/21631
* call.c (reference_binding): Treat lvalue/rvalue mismatch and
dropped cv-quals as a bad conversion.
(convert_like_real) [ck_ref_bind]: Explain them.
(compare_ics): Check badness before stripping reference
bindings. Handle comparing bad reference bindings.
* typeck.c (comp_cv_qualification): Add overload that just takes
integers.
* cp-tree.h: Declare it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110565] [12/13/14/15 Regression] Incomplete note on why initializing int& with int is ill-formed
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
` (4 preceding siblings ...)
2024-03-11 14:27 ` redi at gcc dot gnu.org
@ 2024-07-19 13:20 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-07-19 13:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110565
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.5 |12.5
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11 branch is being closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-19 13:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 19:36 [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed blubban at gmail dot com
2023-07-05 23:13 ` [Bug c++/110565] [10/11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-07-06 8:18 ` rguenth at gcc dot gnu.org
2023-07-07 10:45 ` [Bug c++/110565] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-07 23:30 ` law at gcc dot gnu.org
2024-03-11 14:27 ` redi at gcc dot gnu.org
2024-07-19 13:20 ` [Bug c++/110565] [12/13/14/15 " rguenth 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).