[Bug c++/108026] New: Confusing pedwarn with template lambda with -std=c++11
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 9 00:58:29 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108026
Bug ID: 108026
Summary: Confusing pedwarn with template lambda with -std=c++11
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
auto a = []<bool whitespace>() {};
```
Compile with `-std=c++11 -pedantic`, we get currently:
```
<source>:1:12: warning: lambda templates are only available with '-std=c++14'
or '-std=gnu++14' [-Wc++14-extensions]
1 | auto a = []<bool whitespace>() {};
| ^
```
But change it to -std=c++14 we get:
```
<source>:1:12: warning: lambda templates are only available with '-std=c++20'
or '-std=gnu++20' [-Wc++20-extensions]
1 | auto a = []<bool whitespace>() {};
| ^
```
I am confused based on the warning/error message which is it?
So I looked into the history of this code and pedwarn message and found that
lamdba templates were proposed as part of the original paper about expanding
lamdba for C++14, N3418 but they were removed by before the approval of C++14,
N3559. And then finally in C++20 they were added back.
Anyways the pedwarn message is just confusing and should be fixed.
More information about the Gcc-bugs
mailing list