Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enforce-check-test.cc: fails with GCC 12.2.0 (no problem with 12.1.0) #3050

Closed
kvtb opened this issue Aug 20, 2022 · 7 comments
Closed

enforce-check-test.cc: fails with GCC 12.2.0 (no problem with 12.1.0) #3050

kvtb opened this issue Aug 20, 2022 · 7 comments

Comments

@kvtb
Copy link

kvtb commented Aug 20, 2022

In file included from /build/fetchgit/include/fmt/format.h:48,
                 from /build/fetchgit/include/fmt/chrono.h:21,
                 from /build/fetchgit/test/enforce-checks-test.cc:11:
/build/fetchgit/include/fmt/core.h: In instantiation of 'constexpr decltype (ctx.begin()) fmt::v9::detail::parse_format_specs(ParseContext&) [with T = std::vector<char>; ParseContext = compile_parse_context<char, error_handler>; decltype (ctx.begin()) = const char*]':
/build/fetchgit/include/fmt/core.h:2923:22:   required from 'constexpr fmt::v9::detail::format_string_checker<Char, ErrorHandler, Args>::format_string_checker(fmt::v9::basic_string_view<Char>, ErrorHandler) [with Char = char; ErrorHandler = fmt::v9::detail::error_handler; Args = {std::vector<char, std::allocator<char>
>}]'
/build/fetchgit/test/enforce-checks-test.cc:55:20:   required from here
/build/fetchgit/include/fmt/core.h:2713:12: error: use of deleted function 'fmt::v9::detail::fallback_formatter<T, Char, Enable>::fallback_formatter() [with T = std::vector<char>; Char = char; Enable = void]'
 2713 |   auto f = conditional_t<has_formatter<mapped_type, context>::value,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2714 |                          formatter<mapped_type, char_type>,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2715 |                          fallback_formatter<stripped_type, char_type>>();
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/fetchgit/include/fmt/core.h:1105:3: note: declared here
 1105 |   fallback_formatter() = delete;
      |   ^~~~~~~~~~~~~~~~~~
@kvtb
Copy link
Author

kvtb commented Aug 20, 2022

reproducible with 9.0.0 and git master (fbb568b)

8.1.1 has no problem

@vitaut
Copy link
Contributor

vitaut commented Aug 20, 2022

Could you provide a godbolt repro? I tried to reproduce on gcc trunk but to no avail: https://godbolt.org/z/5444Eazv5. Perhaps some specific compiler options are required.

@kvtb
Copy link
Author

kvtb commented Aug 22, 2022

Could you provide a godbolt repro? I tried to reproduce on gcc trunk but to no avail: https://godbolt.org/z/5444Eazv5. Perhaps some specific compiler options are required.

golbolt does not have GCC 12.2.0, the latest GCC there is 12.1.0 which has no problem

@chronoxor
Copy link
Contributor

gcc 12.x is buggy, for example it generates another error for return "(" + std::to_string(123) + ")";
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329

C:/msys64/mingw64/include/c++/12.2.0/bits/char_traits.h:431:56: error: 'void* __builtin_memcpy(void*, const void*, long long unsigned int)' accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
  431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |         

So it's better to wait until gcc 12.x becomes more stable.

@strega-nil-ms
Copy link

strega-nil-ms commented Aug 23, 2022

This is not GCC's bug - it is correctly (I assume) implementing P2499 (see #3030)

@vitaut
Copy link
Contributor

vitaut commented Aug 26, 2022

@kvtb, does e4f4fc7 fix the issue?

@vitaut
Copy link
Contributor

vitaut commented Aug 26, 2022

Should be fixed in 4a8e294.

@vitaut vitaut closed this as completed Aug 26, 2022
mtremer pushed a commit to ipfire/ipfire-2.x that referenced this issue Nov 28, 2022
- Update from version 9.0.0 to 9.1.0
- Update of rootfile
- Changelog
    9.1.0 - 2022-08-27
	* ``fmt::formatted_size`` now works at compile time
		  `#3026 <https://github.com/fmtlib/fmt/pull/3026>`_
			  For example (`godbolt <https://godbolt.org/z/1MW5rMdf8>`__):
			   .. code:: c++
			     #include <fmt/compile.h>
			     int main() {
			       using namespace fmt::literals;
			       constexpr size_t n = fmt::formatted_size("{}"_cf, 42);
			       fmt::print("{}\n", n); // prints 2
			     }
	* Fixed handling of invalid UTF-8
		  `#3038 <https://github.com/fmtlib/fmt/pull/3038>`_,
		  `#3044 <https://github.com/fmtlib/fmt/pull/3044>`_,
		  `#3056 <https://github.com/fmtlib/fmt/pull/3056>`_
	* Improved Unicode support in ``ostream`` overloads of ``print``
		  `#2994 <https://github.com/fmtlib/fmt/pull/2994>`_,
		  `#3001 <https://github.com/fmtlib/fmt/pull/3001>`_,
		  `#3025 <https://github.com/fmtlib/fmt/pull/3025>`_
	* Fixed handling of the sign specifier in localized formatting on systems with
	   32-bit ``wchar_t``
		  `#3041 <https://github.com/fmtlib/fmt/issues/3041>`_).
	* Added support for wide streams to ``fmt::streamed``
		  `#2994 <https://github.com/fmtlib/fmt/pull/2994>`_
	* Added the ``n`` specifier that disables the output of delimiters when
	   formatting ranges
		  `#2981 <https://github.com/fmtlib/fmt/pull/2981>`_,
		  `#2983 <https://github.com/fmtlib/fmt/pull/2983>`_
			  For example (`godbolt <https://godbolt.org/z/roKqGdj8c>`__):
			   .. code:: c++
			     #include <fmt/ranges.h>
			     #include <vector>
			     int main() {
			       auto v = std::vector{1, 2, 3};
			       fmt::print("{:n}\n", v); // prints 1, 2, 3
			     }
	* Worked around problematic ``std::string_view`` constructors introduced in C++23
		  `#3030 <https://github.com/fmtlib/fmt/issues/3030>`_,
		  `#3050 <https://github.com/fmtlib/fmt/issues/3050>`_
	* Improve handling (exclusion) of recursive ranges
		  `#2968 <https://github.com/fmtlib/fmt/issues/2968>`_,
		  `#2974 <https://github.com/fmtlib/fmt/pull/2974>`_
	* Improved error reporting in format string compilation
		  `#3055 <https://github.com/fmtlib/fmt/issues/3055>`_
	* Improved the implementation of
		  `Dragonbox <https://github.com/jk-jeon/dragonbox>`_, the algorithm used for
		   the default floating-point formatting
		  `#2984 <https://github.com/fmtlib/fmt/pull/2984>`_
	* Fixed issues with floating-point formatting on exotic platforms.
	* Improved the implementation of chrono formatting
		  `#3010 <https://github.com/fmtlib/fmt/pull/3010>`_
	* Improved documentation
		  `#2966 <https://github.com/fmtlib/fmt/pull/2966>`_,
		  `#3009 <https://github.com/fmtlib/fmt/pull/3009>`_,
		  `#3020 <https://github.com/fmtlib/fmt/issues/3020>`_,
		  `#3037 <https://github.com/fmtlib/fmt/pull/3037>`_
	* Improved build configuration
		  `#2991 <https://github.com/fmtlib/fmt/pull/2991>`_,
		  `#2995 <https://github.com/fmtlib/fmt/pull/2995>`_,
		  `#3004 <https://github.com/fmtlib/fmt/issues/3004>`_,
		  `#3007 <https://github.com/fmtlib/fmt/pull/3007>`_,
		  `#3040 <https://github.com/fmtlib/fmt/pull/3040>`_
	* Fixed various warnings and compilation issues
		  `#2969 <https://github.com/fmtlib/fmt/issues/2969>`_,
		  `#2971 <https://github.com/fmtlib/fmt/pull/2971>`_,
		  `#2975 <https://github.com/fmtlib/fmt/issues/2975>`_,
		  `#2982 <https://github.com/fmtlib/fmt/pull/2982>`_,
		  `#2985 <https://github.com/fmtlib/fmt/pull/2985>`_,
		  `#2988 <https://github.com/fmtlib/fmt/issues/2988>`_,
		  `#3000 <https://github.com/fmtlib/fmt/issues/3000>`_,
		  `#3006 <https://github.com/fmtlib/fmt/issues/3006>`_,
		  `#3014 <https://github.com/fmtlib/fmt/issues/3014>`_,
		  `#3015 <https://github.com/fmtlib/fmt/issues/3015>`_,
		  `#3021 <https://github.com/fmtlib/fmt/pull/3021>`_,
		  `#3023 <https://github.com/fmtlib/fmt/issues/3023>`_,
		  `#3024 <https://github.com/fmtlib/fmt/pull/3024>`_,
		  `#3029 <https://github.com/fmtlib/fmt/pull/3029>`_,
		  `#3043 <https://github.com/fmtlib/fmt/pull/3043>`_,
		  `#3052 <https://github.com/fmtlib/fmt/issues/3052>`_,
		  `#3053 <https://github.com/fmtlib/fmt/pull/3053>`_,
		  `#3054 <https://github.com/fmtlib/fmt/pull/3054>`_

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants