public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99158] New: [Enhancement] Better error message when missing #include<new> and using placement new
@ 2021-02-19 8:42 kirshamir at gmail dot com
2021-02-19 11:22 ` [Bug c++/99158] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: kirshamir at gmail dot com @ 2021-02-19 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99158
Bug ID: 99158
Summary: [Enhancement] Better error message when missing
#include<new> and using placement new
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kirshamir at gmail dot com
Target Milestone: ---
Use of placement new requires #include <new>
Without this include the error message is something like:
error: no matching function for call to 'operator new(sizetype, A*)'
8 | new (this) A(other);
| ^
note: candidate function not viable: no known conversion from 'A *' to
'std::align_val_t' for 2nd argument
note: candidate function not viable: requires 1 argument, but 2 were provided
Many std headers have #include <new> thus users just usually write placement
new without a special include and everything works fine, but when code moves
around above error message may just pop up.
A better error might be:
error: no matching function for call to 'operator new'
Note: use of placement new requires #include <new>
...
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/99158] Better error message when missing #include<new> and using placement new
2021-02-19 8:42 [Bug c++/99158] New: [Enhancement] Better error message when missing #include<new> and using placement new kirshamir at gmail dot com
@ 2021-02-19 11:22 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2021-02-19 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99158
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Summary|[Enhancement] Better error |Better error message when
|message when missing |missing #include<new> and
|#include<new> and using |using placement new
|placement new |
Ever confirmed|0 |1
Last reconfirmed| |2021-02-19
Severity|normal |enhancement
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed. We should offer a fix-it hint as we do for other missing headers.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-19 11:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 8:42 [Bug c++/99158] New: [Enhancement] Better error message when missing #include<new> and using placement new kirshamir at gmail dot com
2021-02-19 11:22 ` [Bug c++/99158] " 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).