public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106166] New: Improve diagnostic for explicit constructor
@ 2022-07-02 1:44 mpolacek at gcc dot gnu.org
2022-07-02 7:15 ` [Bug c++/106166] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-02 1:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106166
Bug ID: 106166
Summary: Improve diagnostic for explicit constructor
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
This is not valid code:
struct E { explicit E(int); };
void
g ()
{
E e = 1; // error
}
but we only say
q1.C:5:9: error: conversion from ‘int’ to non-scalar type ‘E’ requested
5 | E e = 1; // error
It would be nice to explain that an explicit constructor is not a candidate in
copy-initialization context.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/106166] Improve diagnostic for explicit constructor
2022-07-02 1:44 [Bug c++/106166] New: Improve diagnostic for explicit constructor mpolacek at gcc dot gnu.org
@ 2022-07-02 7:15 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-02 7:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106166
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-07-02
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes I've been bothered by this for a while. I think this diagnostic is
mentioned in another PR too, contrasting it to the way we display errors for
non-explicit ctors.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-02 7:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-02 1:44 [Bug c++/106166] New: Improve diagnostic for explicit constructor mpolacek at gcc dot gnu.org
2022-07-02 7:15 ` [Bug c++/106166] " redi 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).