https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120969
Bug ID: 120969 Summary: two consecutive '[' shall only introduce an attribute before '[' token Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: f.heckenb...@fh-soft.de Target Milestone: --- (see output below) - First of all, GCC is complaining about its own standard library here! - The first message doesn't seem to make much sense at all, attribute only before '[' token, what? (The actual usage looks like a perfectly cromulent attribute to me, anyway. That's why I'm reporting this against the compiler, not the library, as I suspect the bug is in the compiler.) - The errors only appear with "-fconcepts-ts" which I only use because GCC suggested (required) me to (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120917). If someone could comment on my proposed workaround there (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120917#c17), maybe I could avoid using this flag and these errors. (Though even then, the errors seem strange and worth investigating ...) % dpkg -l | grep libstdc++ ii libstdc++-14-dev:amd64 14.2.0-19 amd64 GNU Standard C++ Library v3 (development files) ii libstdc++6:amd64 14.2.0-19 amd64 GNU Standard C++ Library v3 % tail -n+3750 /usr/include/c++/14/format | head -n 7 template<typename... _Tp> requires (sizeof...(_Tp) == sizeof...(_Args)) [[__gnu__::__always_inline__]] _Arg_store(_Tp&... __a) noexcept : _M_args{_S_make_elt(__a)...} { } % cat test.cpp #include <memory> % g++ --std="c++23" -Wpedantic -pedantic -pedantic-errors -Wall -Wextra -fconcepts-ts -c /tmp/test.cpp cc1plus: note: '-fconcepts-ts' is deprecated and will be removed in GCC 15; please convert your code to C++20 concepts In file included from /usr/include/c++/14/ostream:43, from /usr/include/c++/14/bits/unique_ptr.h:43, from /usr/include/c++/14/memory:78, from /tmp/test.cpp:1: /usr/include/c++/14/format:3753:9: error: two consecutive '[' shall only introduce an attribute before '[' token 3753 | [[__gnu__::__always_inline__]] | ^ /usr/include/c++/14/format:4220:5: error: two consecutive '[' shall only introduce an attribute before '[' token 4220 | [[__gnu__::__always_inline__]] | ^ /usr/include/c++/14/format:4227:5: error: two consecutive '[' shall only introduce an attribute before '[' token 4227 | [[__gnu__::__always_inline__]] | ^ /usr/include/c++/14/format:4234:5: error: two consecutive '[' shall only introduce an attribute before '[' token 4234 | [[__gnu__::__always_inline__]] | ^ /usr/include/c++/14/format:4244:5: error: two consecutive '[' shall only introduce an attribute before '[' token 4244 | [[__gnu__::__always_inline__]] | ^ /usr/include/c++/14/format: In function 'std::string std::vformat(string_view, format_args)': /usr/include/c++/14/format:4258:20: error: no matching function for call to 'vformat_to(std::__format::_Sink_iter<char>, std::string_view&, std::format_args&)' 4258 | std::vformat_to(__buf.out(), __fmt, __args); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, string_view, format_args)' 4222 | vformat_to(_Out __out, string_view __fmt, format_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4222:5: note: constraints not satisfied /usr/include/c++/14/format:4229:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, wstring_view, wformat_args)' 4229 | vformat_to(_Out __out, wstring_view __fmt, wformat_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4229:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4229:5: note: constraints not satisfied /usr/include/c++/14/format:4236:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, string_view, format_args)' 4236 | vformat_to(_Out __out, const locale& __loc, string_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4236:5: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/format:4246:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, wstring_view, wformat_args)' 4246 | vformat_to(_Out __out, const locale& __loc, wstring_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4246:5: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/format: In function 'std::wstring std::vformat(wstring_view, wformat_args)': /usr/include/c++/14/format:4268:20: error: no matching function for call to 'vformat_to(std::__format::_Sink_iter<wchar_t>, std::wstring_view&, std::wformat_args&)' 4268 | std::vformat_to(__buf.out(), __fmt, __args); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, string_view, format_args)' 4222 | vformat_to(_Out __out, string_view __fmt, format_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4222:5: note: constraints not satisfied /usr/include/c++/14/format:4229:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, wstring_view, wformat_args)' 4229 | vformat_to(_Out __out, wstring_view __fmt, wformat_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4229:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4229:5: note: constraints not satisfied /usr/include/c++/14/format:4236:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, string_view, format_args)' 4236 | vformat_to(_Out __out, const locale& __loc, string_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4236:5: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/format:4246:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, wstring_view, wformat_args)' 4246 | vformat_to(_Out __out, const locale& __loc, wstring_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4246:5: note: candidate expects 4 arguments, 3 provided /usr/include/c++/14/format: In function 'std::string std::vformat(const locale&, string_view, format_args)': /usr/include/c++/14/format:4278:20: error: no matching function for call to 'vformat_to(std::__format::_Sink_iter<char>, const std::locale&, std::string_view&, std::format_args&)' 4278 | std::vformat_to(__buf.out(), __loc, __fmt, __args); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, string_view, format_args)' 4222 | vformat_to(_Out __out, string_view __fmt, format_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4229:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, wstring_view, wformat_args)' 4229 | vformat_to(_Out __out, wstring_view __fmt, wformat_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4229:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4236:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, string_view, format_args)' 4236 | vformat_to(_Out __out, const locale& __loc, string_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4236:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4236:5: note: constraints not satisfied /usr/include/c++/14/format:4246:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, wstring_view, wformat_args)' 4246 | vformat_to(_Out __out, const locale& __loc, wstring_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4246:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4246:5: note: constraints not satisfied /usr/include/c++/14/format: In function 'std::wstring std::vformat(const locale&, wstring_view, wformat_args)': /usr/include/c++/14/format:4288:20: error: no matching function for call to 'vformat_to(std::__format::_Sink_iter<wchar_t>, const std::locale&, std::wstring_view&, std::wformat_args&)' 4288 | std::vformat_to(__buf.out(), __loc, __fmt, __args); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, string_view, format_args)' 4222 | vformat_to(_Out __out, string_view __fmt, format_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4229:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, wstring_view, wformat_args)' 4229 | vformat_to(_Out __out, wstring_view __fmt, wformat_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4229:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4236:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, string_view, format_args)' 4236 | vformat_to(_Out __out, const locale& __loc, string_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4236:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4236:5: note: constraints not satisfied /usr/include/c++/14/format:4246:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, wstring_view, wformat_args)' 4246 | vformat_to(_Out __out, const locale& __loc, wstring_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4246:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4246:5: note: constraints not satisfied /usr/include/c++/14/ostream: In function 'void std::vprint_nonunicode(ostream&, string_view, format_args)': /usr/include/c++/14/ostream:892:24: error: no matching function for call to 'vformat_to(std::__format::_Sink_iter<char>, std::locale, std::string_view&, std::format_args&)' 892 | std::vformat_to(__buf.out(), __os.getloc(), __fmt, __args); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, string_view, format_args)' 4222 | vformat_to(_Out __out, string_view __fmt, format_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4222:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4229:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, wstring_view, wformat_args)' 4229 | vformat_to(_Out __out, wstring_view __fmt, wformat_args __args) | ^~~~~~~~~~ /usr/include/c++/14/format:4229:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/format:4236:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, string_view, format_args)' 4236 | vformat_to(_Out __out, const locale& __loc, string_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4236:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4236:5: note: constraints not satisfied /usr/include/c++/14/format:4246:5: note: candidate: 'template<class _Out> requires <erroneous-expression> _Out std::vformat_to(_Out, const locale&, wstring_view, wformat_args)' 4246 | vformat_to(_Out __out, const locale& __loc, wstring_view __fmt, | ^~~~~~~~~~ /usr/include/c++/14/format:4246:5: note: template argument deduction/substitution failed: /usr/include/c++/14/format:4246:5: note: constraints not satisfied