No warning message generated by g++ when using [[nodiscard]] and compile with lower stl option
is there nodiscard attribute available in c++11? If not, why no warning message output by g++ code belows. //test.cpp #include<iostream> [[nodiscard]] int foo() { return 1; } int main() { std::cout<<foo()<<std::endl; return 0; } At the beginning, i complie the program by "g++ -std=c++20 test.cpp -o test.o" and everythings is fine. But then i want… Read More No warning message generated by g++ when using [[nodiscard]] and compile with lower stl option