https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99568
Bug ID: 99568 Summary: ICE when compiling basic module: internal compiler error: in module_may_redeclare, at cp/module.cc:18453 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ryan.burn at gmail dot com Target Milestone: --- Here's how to reproduce /// say_hello.cc module; #include <iostream> #include <string_view> export module Hello; // the module purview starts here // provide a function to users by exporting it export void SayHello (std::string_view const &name) { std::cout << "Hello " << name << "!\n"; } /// main.cc import Hello; #include <string_view> int main() { SayHello("world"); return 0; } If I compile with g++ -fmodules-ts -std=c++20 -c say_hello.cc g++ -fmodules-ts -std=c++20 -c main.cc I get the ICE below. This is my gcc version root@15a43977d8e1:/hello-world# g++ --version g++ (GCC) 11.0.1 20210311 (experimental) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@15a43977d8e1:/hello-world# g++ -fmodules-ts -std=c++20 -c main.cc In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:61, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:429:7: error: template definition of non-template 'enum std::__is_nonvolatile_trivially_copyable<_Tp>::<unnamed>' 429 | enum { __value = __is_trivially_copyable(_Tp) }; | ^~~~ /usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:436:12: error: redefinition of 'struct std::__is_nonvolatile_trivially_copyable<volatile _Tp>' 436 | struct __is_nonvolatile_trivially_copyable<volatile _Tp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:61, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/ios:40, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:436:12: note: previous definition of 'struct std::__is_nonvolatile_trivially_copyable<volatile _Tp>' 436 | struct __is_nonvolatile_trivially_copyable<volatile _Tp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:63, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/ext/numeric_traits.h:159:41: error: template definition of non-template 'const int __gnu_cxx::__numeric_traits_floating<_Value>::__max_digits10' 159 | static const int __max_digits10 = __glibcxx_max_digits10(_Value); | ^~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/ext/numeric_traits.h:162:39: error: template definition of non-template 'const bool __gnu_cxx::__numeric_traits_floating<_Value>::__is_signed' 162 | static const bool __is_signed = true; | ^~~~ /usr/local/include/c++/11.0.1/ext/numeric_traits.h:163:37: error: template definition of non-template 'const int __gnu_cxx::__numeric_traits_floating<_Value>::__digits10' 163 | static const int __digits10 = __glibcxx_digits10(_Value); | ^~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/ext/numeric_traits.h:164:43: error: template definition of non-template 'const int __gnu_cxx::__numeric_traits_floating<_Value>::__max_exponent10' 164 | static const int __max_exponent10 = __glibcxx_max_exponent10(_Value); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:231:11: error: conflicting global module declaration 'template<class _Tp> using __remove_cv_t = typename std::remove_cv@Hello::type' 231 | using __remove_cv_t = typename remove_cv<_Tp>::type; | ^~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:231:11: note: existing declaration 'template<class _Tp> using __remove_cv_t = typename std::remove_cv::type' 231 | using __remove_cv_t = typename remove_cv<_Tp>::type; | ^~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:249:45: note: during load of pendings for 'std::__remove_cv_t' 249 | : public __is_void_helper<__remove_cv_t<_Tp>>::type | ^~~ /usr/local/include/c++/11.0.1/type_traits:820:40: error: template definition of non-template 'typedef decltype (__test<_Tp>(0)) std::__is_destructible_impl<_Tp>::type' 820 | typedef decltype(__test<_Tp>(0)) type; | ^~~~ /usr/local/include/c++/11.0.1/type_traits:871:40: error: template definition of non-template 'typedef decltype (__test<_Tp>(0)) std::__is_nt_destructible_impl<_Tp>::type' 871 | typedef decltype(__test<_Tp>(0)) type; | ^~~~ /usr/local/include/c++/11.0.1/type_traits:1102:12: error: redefinition of 'struct std::__is_nt_copy_assignable_impl<_Tp, false>' 1102 | struct __is_nt_copy_assignable_impl<_Tp, false> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:1102:12: note: previous definition of 'struct std::__is_nt_copy_assignable_impl<_Tp, false>' 1102 | struct __is_nt_copy_assignable_impl<_Tp, false> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:1106:12: error: redefinition of 'struct std::__is_nt_copy_assignable_impl<_Tp, true>' 1106 | struct __is_nt_copy_assignable_impl<_Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:1106:12: note: previous definition of 'struct std::__is_nt_copy_assignable_impl<_Tp, true>' 1106 | struct __is_nt_copy_assignable_impl<_Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:1566:21: error: default argument for template parameter for class enclosing 'std::__add_lvalue_reference_helper<_Tp, <anonymous> >::type' 1566 | { typedef _Tp type; }; | ^~~~ /usr/local/include/c++/11.0.1/type_traits:1566:21: error: template definition of non-template 'typedef _Tp std::__add_lvalue_reference_helper<_Tp, <anonymous> >::type' /usr/local/include/c++/11.0.1/type_traits:1569:12: error: redefinition of 'struct std::__add_lvalue_reference_helper<_Tp, true>' 1569 | struct __add_lvalue_reference_helper<_Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:1569:12: note: previous definition of 'struct std::__add_lvalue_reference_helper<_Tp, true>' 1569 | struct __add_lvalue_reference_helper<_Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:1575:47: error: wrong number of template arguments (1, should be 2) 1575 | : public __add_lvalue_reference_helper<_Tp> | ^ /usr/local/include/c++/11.0.1/type_traits:1565:12: note: provided for 'template<class _Tp, bool <anonymous> > struct std::__add_lvalue_reference_helper' 1565 | struct __add_lvalue_reference_helper | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:1945:12: error: redefinition of 'struct std::remove_all_extents< <template-parameter-1-1> >' 1945 | struct remove_all_extents | ^~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:790:12: note: previous definition of 'struct std::remove_all_extents< <template-parameter-1-1> >' 790 | struct remove_all_extents; | ^~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:1949:12: error: redefinition of 'struct std::remove_all_extents<_Tp [_Size]>' 1949 | struct remove_all_extents<_Tp[_Size]> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:1949:12: note: previous definition of 'struct std::remove_all_extents<_Tp [_Size]>' 1949 | struct remove_all_extents<_Tp[_Size]> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:1953:12: error: redefinition of 'struct std::remove_all_extents<_Tp []>' 1953 | struct remove_all_extents<_Tp[]> | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:1953:12: note: previous definition of 'struct std::remove_all_extents<_Tp []>' 1953 | struct remove_all_extents<_Tp[]> | ^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:2170:11: error: conflicting global module declaration 'template<class _Tp> using __remove_cvref_t = typename std::remove_cv@Hello<typename std::remove_reference@Hello<_Tp>::type>::type' 2170 | using __remove_cvref_t | ^~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:2170:11: note: existing declaration 'template<class _Tp> using __remove_cvref_t = typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type' 2170 | using __remove_cvref_t | ^~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:2195:77: note: during load of pendings for 'std::__remove_cvref_t' 2195 | static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>> | ^~ /usr/local/include/c++/11.0.1/type_traits:2401:12: error: redefinition of 'struct std::__result_of_memobj<_Res _Class::*, _Arg>' 2401 | struct __result_of_memobj<_Res _Class::*, _Arg> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:2401:12: note: previous definition of 'struct std::__result_of_memobj<_Res _Class::*, _Arg>' 2401 | struct __result_of_memobj<_Res _Class::*, _Arg> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:2416:12: error: redefinition of 'struct std::__result_of_memfun<_Res _Class::*, _Arg, _Args ...>' 2416 | struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:2416:12: note: previous definition of 'struct std::__result_of_memfun<_Res _Class::*, _Arg, _Args ...>' 2416 | struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:3292:11: error: conflicting global module declaration 'template<class _From, class _To> using __copy_cv = typename std::__match_cv_qualifiers@Hello<_From, _To>::__type' 3292 | using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type; | ^~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:3292:11: note: existing declaration 'template<class _From, class _To> using __copy_cv = typename std::__match_cv_qualifiers<_From, _To>::__type' 3292 | using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type; | ^~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:3309:45: note: during load of pendings for 'std::__copy_cv' 3309 | __void_t<__cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>>> | ^ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:3357:11: error: conflicting global module declaration 'template<class _Tp1, class _Tp2> using __basic_common_ref = typename std::basic_common_reference<typename std::remove_cv@Hello<typename std::remove_reference@Hello<_Tp>::type>::type, typename std::remove_cv@Hello<typename std::remove_reference@Hello<_Arg>::type>::type, std::__xref@Hello<_Tp>::template __type, std::__xref@Hello<_Tp2>::template __type>::type' 3357 | using __basic_common_ref | ^~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:3357:11: note: existing declaration 'template<class _Tp1, class _Tp2> using __basic_common_ref = typename std::basic_common_reference<typename std::remove_cv@Hello<typename std::remove_reference@Hello<_Tp>::type>::type, typename std::remove_cv<typename std::remove_reference<_Arg>::type>::type, std::__xref<_Tp>::template __type, std::__xref<_Tp2>::template __type>::type' 3357 | using __basic_common_ref | ^~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:2522:11: error: conflicting global module declaration 'template<class ... _Tp> using common_type_t = typename std::common_type@Hello::type' 2522 | using common_type_t = typename common_type<_Tp...>::type; | ^~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:2522:11: note: existing declaration 'template<class ... _Tp> using common_type_t = typename std::common_type::type' 2522 | using common_type_t = typename common_type<_Tp...>::type; | ^~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:3381:54: note: during load of pendings for 'std::__common_reference_impl' 3381 | : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1> | ^ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40, from /usr/local/include/c++/11.0.1/exception:148, from /usr/local/include/c++/11.0.1/ios:39, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/type_traits:3367:11: error: conflicting global module declaration 'template<class ... _Tp> using common_reference_t = typename std::common_reference@Hello::type' 3367 | using common_reference_t = typename common_reference<_Tp...>::type; | ^~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/move.h:57, from /usr/local/include/c++/11.0.1/bits/stl_pair.h:59, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/type_traits:3367:11: note: existing declaration 'template<class ... _Tp> using common_reference_t = typename std::common_reference::type' 3367 | using common_reference_t = typename common_reference<_Tp...>::type; | ^~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/type_traits:3445:63: note: during load of pendings for 'std::common_reference_t' 3445 | void_t<common_reference_t<_Tp1, _Tp2>>> | ^~~~ In file included from /usr/local/include/c++/11.0.1/bits/stl_pair.h:65, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/ios:40, from /usr/local/include/c++/11.0.1/ostream:38, from /usr/local/include/c++/11.0.1/iostream:39, from say_hello.cc:4, of module Hello, imported at main.cc:2: /usr/local/include/c++/11.0.1/compare:405:11: error: conflicting global module declaration 'template<class ... _Ts> using common_comparison_category_t = typename std::common_comparison_category@Hello::type' 405 | using common_comparison_category_t | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/c++/11.0.1/bits/stl_pair.h:65, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:64, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/compare:405:11: note: existing declaration 'template<class ... _Ts> using common_comparison_category_t = typename std::common_comparison_category::type' 405 | using common_comparison_category_t | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/c++/11.0.1/compare:413:57: note: during load of pendings for 'std::common_comparison_category_t' 413 | = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>; | ^ In file included from /usr/local/include/c++/11.0.1/bits/stl_iterator.h:82, from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:67, from /usr/local/include/c++/11.0.1/bits/char_traits.h:39, from /usr/local/include/c++/11.0.1/string_view:41, from main.cc:4: /usr/local/include/c++/11.0.1/new:89:27: internal compiler error: in module_may_redeclare, at cp/module.cc:18453 89 | enum class align_val_t: size_t {}; | ^~~~~~ 0x69ca74 module_may_redeclare(tree_node*) ../../gcc/cp/module.cc:18453 0x981c01 start_enum(tree_node*, tree_node*, tree_node*, tree_node*, bool, bool*) ../../gcc/cp/decl.c:15662 0xa63c27 cp_parser_enum_specifier ../../gcc/cp/parser.c:19975 0xa63c27 cp_parser_type_specifier ../../gcc/cp/parser.c:18401 0xa64919 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:15051 0xa656f1 cp_parser_simple_declaration ../../gcc/cp/parser.c:14308 0xa923c5 cp_parser_declaration ../../gcc/cp/parser.c:14126 0xa91cf9 cp_parser_toplevel_declaration ../../gcc/cp/parser.c:14155 0xa91cf9 cp_parser_declaration_seq_opt ../../gcc/cp/parser.c:13943 0xa92192 cp_parser_namespace_body ../../gcc/cp/parser.c:20443 0xa92192 cp_parser_namespace_definition ../../gcc/cp/parser.c:20421 0xa928e8 cp_parser_declaration ../../gcc/cp/parser.c:14106 0xa91cf9 cp_parser_toplevel_declaration ../../gcc/cp/parser.c:14155 0xa91cf9 cp_parser_declaration_seq_opt ../../gcc/cp/parser.c:13943 0xa93675 cp_parser_linkage_specification ../../gcc/cp/parser.c:15319 0xa924da cp_parser_declaration ../../gcc/cp/parser.c:14045 0xa9313c cp_parser_toplevel_declaration ../../gcc/cp/parser.c:14155 0xa9313c cp_parser_translation_unit ../../gcc/cp/parser.c:4940 0xa9313c c_parse_file() ../../gcc/cp/parser.c:45241 0xbb6e7d c_common_parse_file() ../../gcc/c-family/c-opts.c:1218 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.