Why does -Wabi-tag complain when -std=c++03?

Jeffrey Walton noloader@gmail.com
Thu Mar 24 11:55:00 GMT 2016


I'm working on some test cases to try and understand "GCC5 and the
C++11 ABI", http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/.

In the test program below, why does -Wabi-tag trigger a warning with
the std::string when using -std=c++03?

Thanks in advance.

$ gcc --version
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010


$ cat test.cxx
#include <string>

std::string foo __attribute__ ((visibility ("default")));
std::string bar __attribute__ ((visibility ("default")));


$ g++ -g3 -O2 -Wabi-tag -shared test.cxx -o test.so
test.cxx:3:13: warning: ‘foo’ inherits the "cxx11" ABI tag that
‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ (used in
its type) has [-Wabi-tag]
 std::string foo __attribute__ ((visibility ("default")));
             ^
In file included from /usr/include/c++/5/string:52:0,
                 from test.cxx:1:
/usr/include/c++/5/bits/basic_string.h:71:11: note:
‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ declared
here
     class basic_string
           ^
test.cxx:4:13: warning: ‘bar’ inherits the "cxx11" ABI tag that
‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ (used in
its type) has [-Wabi-tag]
 std::string bar __attribute__ ((visibility ("default")));
             ^
In file included from /usr/include/c++/5/string:52:0,
                 from test.cxx:1:
/usr/include/c++/5/bits/basic_string.h:71:11: note:
‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ declared
here
     class basic_string
           ^



More information about the Gcc-help mailing list