https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122531
Bug ID: 122531
Summary: Warning option to turn off aka inheritance output
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jg at jguk dot org
Target Milestone: ---
Enhancement request.
There is a lot of internals of STL I often do not need to know, I would be
happy to not know std::string was not derived from cxx11::basic_string.
Could there be a new option to turn off the aka expansion and page of output?
This would turn off it all
-Wno-aka-output
I suggest with arguments eg only turn off STL
-Wno-aka-output=stl
#include <string>
int main()
{
const std::string a;
a = "oops";
}
https://godbolt.org/z/TWPqx5eoq
<source>: In function 'int main()':
<source>:5:9: error: no match for 'operator=' (operand types are 'const
std::string' {aka 'const std::__cxx11::basic_string<char>'} and 'const char
[5]')
5 | a = "oops";
| ^~~~~~
• there are 6 candidates
In file included from
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/string:55,
from <source>:1:
• candidate 1: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:904:7:
904 | operator=(const basic_string& __str)
| ^~~~~~~~
• passing 'const std::string*' {aka 'const
std::__cxx11::basic_string<char>*'} as 'this' argument discards qualifiers
• candidate 2: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*)
[with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]' (near match)
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:915:7:
915 | operator=(const _CharT* __s)
| ^~~~~~~~
• passing 'const std::string*' {aka 'const
std::__cxx11::basic_string<char>*'} as 'this' argument discards qualifiers
• candidate 3: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with
_CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]' (near match)
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:927:7:
927 | operator=(_CharT __c)
| ^~~~~~~~
• conversion of argument 1 would be ill-formed:
• error: invalid conversion from 'const char*' to 'char' [-fpermissive]
<source>:5:9:
5 | a = "oops";
| ^~~~~~
| |
| const char*
• candidate 4: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with
_CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]' (near match)
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:945:7:
945 | operator=(basic_string&& __str)
| ^~~~~~~~
• passing 'const std::string*' {aka 'const
std::__cxx11::basic_string<char>*'} as 'this' argument discards qualifiers
• candidate 5: 'template<class _Tp> std::__cxx11::basic_string<_CharT,
_Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const
_Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:1028:8:
1028 | operator=(const _Tp& __svt)
| ^~~~~~~~
• template argument deduction/substitution failed:
In file included from
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/char_traits.h:52,
from
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/string:44:
•
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/type_traits:
In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t =
typename std::enable_if::type [with bool _Cond = false; _Tp =
std::__cxx11::basic_string<char>&]':
• required by substitution of 'template<class _CharT, class _Traits,
class _Alloc> template<class _Tp, class _Res> using
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv =
std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&,
std::basic_string_view<_CharT, _Traits> >,
std::__not_<std::is_convertible<const _Tp*, const
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >,
std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res>
[with _Tp = char [5]; _Res = std::__cxx11::basic_string<char>&; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:160:8:
160 | using _If_sv = enable_if_t<
| ^~~~~~
• required by substitution of 'template<class _Tp>
std::__cxx11::basic_string<char>::_If_sv<_Tp,
std::__cxx11::basic_string<char>&>
std::__cxx11::basic_string<char>::operator=(const _Tp&) [with _Tp = char [5]]'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:1028:8:
1028 | operator=(const _Tp& __svt)
| ^~~~~~~~
• required from here
<source>:5:9:
5 | a = "oops";
| ^~~~~~
• error: no type named 'type' in 'struct std::enable_if<false,
std::__cxx11::basic_string<char>&>'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/type_traits:2900:11:
2900 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
• candidate 6: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&
std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits =
std::char_traits<char>; _Alloc = std::allocator<char>]'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:1013:7:
1013 | operator=(initializer_list<_CharT> __l)
| ^~~~~~~~
• no known conversion for argument 1 from 'const char [5]' to
'std::initializer_list<char>'
/cefs/de/dedb674036b613e12121afbc_gcc-trunk-20251102/include/c++/16.0.0/bits/basic_string.h:1013:42:
1013 | operator=(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Compiler returned: 1