3 ms·
Try it. Here's a completely reasonable line of C++ 17 code: int concept = 4; Now here's a completely reasonable line of C++ 20 code: template <class T> c
by tialaramex 5y ago
Try it. Here's a completely reasonable line of C++ 17 code:
int concept = 4;
Now here's a completely reasonable line of C++ 20 code:
template <class T> concept delicious = true;
Huh. You can't have those in the same project because C++ 20 believes you can't name a variable "concept" and C++ 17 believes "concept" is an identifier and so you can't write your delicious concept template.
These are both valid C++, it's just that they aren't simultaneously valid in any of the half dozen distinct versions of standard C++.
- zozbot234 5y agoC fixes this by using _Concept as the keyword and sticking a #define concept _Concept in a separate stdconcept.h header file. Or maybe it was about complex or whatever, but same deal.
- kldx 5y agoThanks for the example. Is it considered UB to compile the first example with -std=c++17, the second one with c++2a and link them together?