You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DimitryAndric opened this issue
Sep 16, 2018
· 7 comments
Assignees
Labels
bugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.wontfixIssue is real, but we can't or won't fix it. Not invalid
Because https://reviews.llvm.org/rL336132 introduces a few function templates with default template arguments, gcc cannot compile anymore, when targeting c++03 or earlier:
$ echo "#include " | g++ -std=c++03 -nostdinc++ -isystem /usr/include/c++/v1 -x c++ -c - -o -
In file included from :1:
/usr/include/c++/v1/string:812:35: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s) {
^
/usr/include/c++/v1/string:822:62: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s, const _Allocator& __a);
^
/usr/include/c++/v1/string:833:70: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
^
/usr/include/c++/v1/string:844:75: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
const allocator_type& __a = allocator_type());
^
/usr/include/c++/v1/string:848:45: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t);
^
/usr/include/c++/v1/string:852:72: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t, const allocator_type& __a);
^
/usr/include/c++/v1/string:875:43: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string& operator=(const _Tp& __t)
^
Apparently gcc in c++03 mode does accept class templates with default arguments, but not function templates.
https://reviews.llvm.org/D48616 already stated "I may have stepped on a bug fix for old versions of gcc in C++03 mode - Eric? [ was introduced in r292830 ]", and indeed it looks like this has happened.
The text was updated successfully, but these errors were encountered:
bugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.wontfixIssue is real, but we can't or won't fix it. Not invalid
Extended Description
Because https://reviews.llvm.org/rL336132 introduces a few function templates with default template arguments, gcc cannot compile anymore, when targeting c++03 or earlier:
$ echo "#include " | g++ -std=c++03 -nostdinc++ -isystem /usr/include/c++/v1 -x c++ -c - -o -
In file included from :1:
/usr/include/c++/v1/string:812:35: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s) {
^
/usr/include/c++/v1/string:822:62: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s, const _Allocator& __a);
^
/usr/include/c++/v1/string:833:70: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
^
/usr/include/c++/v1/string:844:75: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
const allocator_type& __a = allocator_type());
^
/usr/include/c++/v1/string:848:45: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t);
^
/usr/include/c++/v1/string:852:72: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t, const allocator_type& __a);
^
/usr/include/c++/v1/string:875:43: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11
basic_string& operator=(const _Tp& __t)
^
Apparently gcc in c++03 mode does accept class templates with default arguments, but not function templates.
https://reviews.llvm.org/D48616 already stated "I may have stepped on a bug fix for old versions of gcc in C++03 mode - Eric? [ was introduced in r292830 ]", and indeed it looks like this has happened.
The text was updated successfully, but these errors were encountered: