Author
anonymous
about 2 years ago
Language
C++
Compiler
clang HEAD 17.0.0 (https://github.com/llvm/llvm-project.git 53be2e0f59730671eac24c9e9ce615d20250d917)
Options
Warnings
Don't Use Boost
C++2b(GNU)
-pedantic-errors
Author
anonymous
about 2 years ago
$ clang++ prog.cc -Wall -Wextra -std=gnu++2b -pedantic-errors
prog.cc:17:30: error: call to consteval function 'std::basic_format_string<char, enum_t>::basic_format_string<char[3]>' is not a constant expression
std::cout << std::format("{}", enum_t::cat) << '\n';
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_functions.h:266:7: note: non-constexpr function '__throw_format_error' cannot be used in a constant expression
std::__throw_format_error("Argument index out of bounds");
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_functions.h:313:13: note: in call to '__handle_replacement_field(&"{}"[1], &"{}"[2], basic_format_parse_context<char>{this->__str_, sizeof...(_Args)}, _Context{__types_.data(), __handles_.data(), sizeof...(_Args)})'
__format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_functions.h:344:5: note: in call to '__vformat_to(basic_format_parse_context<char>{this->__str_, sizeof...(_Args)}, _Context{__types_.data(), __handles_.data(), sizeof...(_Args)})'
__format::__vformat_to(basic_format_parse_context<_CharT>{__str_, sizeof...(_Args)},
^
prog.cc:17:30: note: in call to 'basic_format_string("{}")'
std::cout << std::format("{}", enum_t::cat) << '\n';
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_error.h:39:1: note: declared here
__throw_format_error(const char* __s) {
^
In file included from prog.cc:1:
In file included from /opt/wandbox/clang-head/include/c++/v1/format:176:
In file included from /opt/wandbox/clang-head/include/c++/v1/__format/container_adaptor.h:21:
In file included from /opt/wandbox/clang-head/include/c++/v1/__format/range_default_formatter.h:24:
In file included from /opt/wandbox/clang-head/include/c++/v1/__format/range_formatter.h:24:
In file included from /opt/wandbox/clang-head/include/c++/v1/__format/format_args.h:16:
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg_store.h:163:17: error: static assertion failed due to requirement '__arg != __arg_t::__none': the supplied type is not formattable
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
^~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg_store.h:205:54: note: in instantiation of function template specialization 'std::__format::__create_format_arg<std::format_context, enum_t &>' requested here
basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg_store.h:241:19: note: in instantiation of function template specialization 'std::__format::__create_packed_storage<std::format_context, enum_t &>' requested here
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_functions.h:69:10: note: in instantiation of member function 'std::__format_arg_store<std::format_context, enum_t &>::__format_arg_store' requested here
return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
^
/opt/wandbox/clang-head/include/c++/v1/__config:667:17: note: expanded from macro '_VSTD'
# define _VSTD std
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_functions.h:467:45: note: in instantiation of function template specialization 'std::make_format_args<std::format_context, enum_t &>' requested here
return _VSTD::vformat(__fmt.get(), _VSTD::make_format_args(__args...));
^
prog.cc:17:23: note: in instantiation of function template specialization 'std::format<enum_t>' requested here
std::cout << std::format("{}", enum_t::cat) << '\n';
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg_store.h:163:23: note: expression evaluates to '0 != 0'
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
~~~~~~^~~~~~~~~~~~~~~~~~
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg_store.h:196:12: error: no matching constructor for initialization of 'basic_format_arg<format_context>'
return basic_format_arg<_Context>{__arg, __value};
^ ~~~~~~~~~~~~~~~~
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg.h:259:34: note: candidate constructor not viable: no known conversion from 'enum_t' to '__basic_format_arg_value<format_context>' for 2nd argument
_LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(__format::__arg_t __type,
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg.h:230:28: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class _LIBCPP_TEMPLATE_VIS basic_format_arg {
^
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg.h:230:28: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
/opt/wandbox/clang-head/include/c++/v1/__format/format_arg.h:234:25: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
_LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept
^
3 errors generated.
Exit Code:
1