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

            Bug ID: 119635
           Summary: ICE in add_indirects, at cp/module.cc:7843
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jonkje at tuta dot io
  Target Milestone: ---

Created attachment 61001
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61001&action=edit
Preprocessed source

This bug, occured when including and using certain boost libraries in the
global module scope. I have tried to whittle it down as much as possible, but I
am not able to make a minimal example or pinpoint where it goes wrong.

Preprocessed source in attachment.

/////////// scratch1_reduced.ixx ///////////

module;

#include <boost/variant/apply_visitor.hpp>

export module ice;

template<typename ...T>
struct variant {};

template <typename T0, typename ...TN>
std::size_t hash_value(variant<T0, TN...> const& val) {
    std::size_t seed = boost::apply_visitor([](auto){return 0u;}, val);
    hash_combine(seed, val.which());
    return seed;
}

template <typename T0, typename ...TN>
struct hash {
    unsigned int operator()(const variant<T0, TN...>& val) const {
        return hash_value(val);
    }
};


/////////// end scratch1_reduced.ixx ///////////


GCC version compiled from git: GNU C++23 (GCC) version 15.0.1 20250403
(experimental) (x86_64-pc-linux-gnu)

Command line: /home/jon/Software/gcc-install/usr/local/bin/g++
/home/jon/.config/JetBrains/CLion2024.3/scratches/scratch1_reduced.ixx -isystem
/home/jon/.vcpkg-clion/vcpkg_gcc-current/installed/x64-linux/include -std=c++23
-Wall -Wextra -Werror -fmodules -c -o scratch1_reduced

Error message:
/home/jon/.config/JetBrains/CLion2024.3/scratches/scratch1_reduced.ixx:5:8:
internal compiler error: in add_indirects, at cp/module.cc:7843
    5 | export module ice;
      |        ^~~~~~
0x2599adf internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:517
0x712b0d fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostic.cc:1749
0x471414 add_indirects
        ../../gcc/cp/module.cc:7843
0x471414 decl_node
        ../../gcc/cp/module.cc:9341
0x88ab85 tree_node
        ../../gcc/cp/module.cc:9977
0x88a0a2 decl_node
        ../../gcc/cp/module.cc:9256
0x88ab85 tree_node
        ../../gcc/cp/module.cc:9977
0x88ef6e tree_list
        ../../gcc/cp/module.cc:5261
0x88faa7 write_class_def
        ../../gcc/cp/module.cc:12902
0x88faa7 write_definition
        ../../gcc/cp/module.cc:13459
0x891624 depset::hash::find_dependencies(module_state*)
        ../../gcc/cp/module.cc:14770
0x892446 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
        ../../gcc/cp/module.cc:19665
0x893dc3 finish_module_processing(cpp_reader*)
        ../../gcc/cp/module.cc:22198
0x81424f c_parse_final_cleanups()
        ../../gcc/cp/decl2.cc:5792
0xa91530 c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1397

Reply via email to