https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113405
Bug ID: 113405
Summary: Can't access member type alias of concept-constrained
class template specialization in global module
fragment via alias template in different module
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eddiejnolan at gmail dot com
Target Milestone: ---
This example shows GCC failing to resolve the member type alias "foobar" in a
concept-constrained specialization of class template "corge" when it's accessed
from module2 via an alias template in module1.
Compiler explorer link: https://godbolt.org/z/4sh6xG6P4
Minimal reproduction:
// CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(repro CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(module1)
target_sources(module1
PUBLIC
FILE_SET cxx_modules TYPE CXX_MODULES FILES
module1.cpp
)
target_include_directories(module1 PRIVATE "include/")
add_library(module2)
target_sources(module2
PUBLIC
FILE_SET cxx_modules TYPE CXX_MODULES FILES
module2.cpp
)
target_link_libraries(module2 PUBLIC module1)
// include/foo.h
template <typename>
concept foo = false;
template <typename>
concept bar = true;
template <typename>
struct corge {};
template <foo T>
struct corge<T> {};
template <bar T>
struct corge<T> {
using foobar = int;
};
// module1.cpp
module;
#include "foo.h"
export module module1;
export template<class T>
using corge_alias = corge<T>::foobar;
// module2.cpp
export module module2;
import module1;
struct foobaz{};
using quux = corge_alias<foobaz>;