I am running:
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
when I run: clang++ *.cpp -o test
, I get:
identifier = nullptr;
^
1 error generated.
however, when I run: clang++ -std=c++11 *.cpp -o test
, I get no errors.
Does anyone else have this issue with the latest version of clang?
Whoever set the duplicate flag, this is not a duplicate. I had made the reasonable assumption that the latest version of clang wouldn't be running C++98 by default. Also, the linked post is from 10 years ago, when C++11 got released...
Apple clang++ 14.0.0 defaults to C++98.
For example with this source file:
You can see this behavior:
The solution is to explicitly request a language standard of C++11 or newer via
-std=c++XY
, as shown above.