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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-04-08
     Ever confirmed|0                           |1
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW
            Summary|[modules] building module   |[14 Regression] [modules]
                   |with submodule causes       |building module with
                   |corrupt gcm                 |submodule causes corrupt
                   |                            |gcm
                 CC|                            |nshead at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
      Known to work|                            |13.2.0

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Thanks for the report, reduced:

$ cat 114630_a.C
module;

#include "format.ii"

export module modB;

$ cat 114630_b.C
module;

#include "format.ii"

export module modA;
import modB;

$ cat 114630_c.C
#include "format.ii"

import modA;

$ cat format.ii
template<typename _CharT>
void _M_do_parse() {
  struct A { };
  struct B { };
}

template<typename, typename>
struct formatter;

template<typename _Tp, typename _CharT>
requires __is_same(_Tp, int)
struct formatter<_Tp, _CharT> { };

template<typename _Tp, typename _CharT>
requires __is_same(_Tp, int*)
struct formatter<_Tp, _CharT> { };

template<> struct formatter<int, char> {
  void parse() { _M_do_parse<int>(); }
};

$ g++ -fmodules-ts -std=c++20 114630_*.C
In module imported at 114630_c.C:3:1:
modA: error: failed to read compiled module cluster 5: Bad file data
modA: note: compiled module file is ‘gcm.cache/modA.gcm’
In file included from 114630_c.C:1:
format.ii:19:34: fatal error: failed to load pendings for ‘::_M_do_parse’
   19 |   void parse() { _M_do_parse<int>(); }
      |                  ~~~~~~~~~~~~~~~~^~
compilation terminated.


We started rejecting this after r14-8408.  We seem to be streaming in the
definition of _M_do_parse<int>() twice, dunno if that's expected or not.

Reply via email to