https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127642

--- Comment #1 from d7d1cd <d7d1cd at mail dot ru> ---
However, the following example does not compile with 16.x compilers, even using
the C++23 standard:

    $ cat header.h
    #pragma once
    #include <chrono>
    inline void foo() {
        std::ignore = std::format("{}", std::chrono::seconds{});
    }


    $ cat module.ixx
    module;
    #include "header.h"
    export module M;
    export using ::foo;


    $ cat main.cc
    #include "header.h"
    import M;


    $ g++ -std=c++23 -fmodules -fmax-errors=1 -c module.ixx main.cc
    In file included from /usr/local/gcc-trunk/include/c++/16/chrono:3695,
                    from header.h:3,
                    from module.ixx:2,
    of module M, imported at main.cc:2:
    /usr/local/gcc-trunk/include/c++/16/bits/chrono_io.h:903:38: error:
conflicting type for imported declaration ‘constexpr const char* const
std::__format::__formatter_chrono<char>::_S_months [12]’
      903 |       static constexpr const _CharT* _S_months[]
          |                                      ^~~~~~~~~
    In file included from /usr/local/gcc-trunk/include/c++/16/chrono:3695,
                    from header.h:3,
                    from main.cc:1:
    /usr/local/gcc-trunk/include/c++/16/bits/chrono_io.h:903:38: note: existing
declaration ‘constexpr const char* const
std::__format::__formatter_chrono<char>::_S_months []’
      903 |       static constexpr const _CharT* _S_months[]
          |                                      ^~~~~~~~~
    compilation terminated due to -fmax-errors=1.


https://godbolt.org/z/GTTEzKfnd

Reply via email to