https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90342
Bug ID: 90342
Summary: Misleading #include system fixit when using an older
C++ version
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blitzrakete at gmail dot com
Target Milestone: ---
#include <memory>
int main() {
std::make_unique<int>();
}
If I compile this with -std=c++11, I get:
<source>: In function 'int main()':
<source>:4:8: error: 'make_unique' is not a member of 'std'
4 | std::make_unique<int>();
| ^~~~~~~~~~~
<source>:2:1: note: 'std::make_unique' is defined in header '<memory>'; did you
forget to '#include <memory>'?
1 | #include <memory>
+++ |+#include <memory>
2 |
<source>:4:20: error: expected primary-expression before 'int'
4 | std::make_unique<int>();
| ^~~
Compiler returned: 1
That note is very misleading, since failing to include that header is not the
reason why std::make_unique doesn't exist.