-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules
Description
Test code (CE):
export module M;
export template <class> struct S {};
// ❌ - Clang/MSVC/EDG: OK
// ✅ - GCC:
// - error: declaration of partial specialization in unbraced
// export-declaration
// - note: a specialization is always exported alongside its
// primary template
export template <class T> struct S<T *> {};
// ❌ - Clang/MSVC/EDG: OK
// ✅ - GCC: error: explicit instantiations are not permitted here
export template struct S<int>;
// ❌ - Clang/MSVC/EDG: OK
// ✅ - GCC:
// - error: explicit specializations are not permitted here
// - note: a specialization is always exported alongside its
// primary template
export template <> struct S<void> {};P2615R1 forbids applying export directly to partial specializations and explicit instantiations/specializations, as doing so is meaningless. (These declarations are allowed to appear within an export block for convenience.) The code above should be diagnosed accordingly.
Related: #147135.
Metadata
Metadata
Assignees
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header Modules