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

--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
// bug.h
template<typename _Tp>
class new_allocator
{
public:
  template<typename _Tp1>
  new_allocator(const new_allocator<_Tp1>&) noexcept { }
};

extern template class new_allocator<char>;
// bug_a.H
#include "bug.h"
// bug_b.H
#include "bug.h"
// bug_c.C
import "bug_a.H";
import "bug_b.H";

/cc1plus -quiet -fmodule-header bug_a.H && ./cc1plus -quiet -fmodule-header
bug_b.H && ./cc1plus -quiet -fmodules-ts bug_c.C -fno-module-lazy 
bug_c.C:3:18: internal compiler error: tree check: expected template_decl, have
function_decl in decl_value, at cp/module.cc:7938
    3 | import "bug_b.H";
      |                  ^
0x1acdd53 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../../src/gcc/tree.c:9816
0xad685c tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../../src/gcc/tree.h:3353
0xcc2df7 trees_in::decl_value()
        ../../../src/gcc/cp/module.cc:7938
0xcc8e49 trees_in::tree_node(bool)
        ../../../src/gcc/cp/module.cc:9174
0xce2a7f module_state::read_cluster(unsigned int)
        ../../../src/gcc/cp/module.cc:14858
0xcebdc6 module_state::load_section(unsigned int, binding_slot*)
        ../../../src/gcc/cp/module.cc:18129
0xcebaf0 module_state::read_language(bool)
        ../../../src/gcc/cp/module.cc:18058
0xcee601 direct_import
        ../../../src/gcc/cp/module.cc:18920

Reply via email to