Open
Description
Run a compiler on this code:
// --- foo.cppm
export module foo;
export struct partial {};
export template <class T, class Cat = partial> concept is_comparable = true;
// --- bar.cppm
export module bar;
import foo;
template <class T>
void func() requires is_comparable<T> {}
The exact commands are:
$ clang++ -std=c++20 --precompile foo.cppm
$ clang++ -std=c++20 --precompile bar.cppm -fmodule-file=foo.pcm
Expected results: code compiles with no errors.
Actual: Clang produces the following error when compiling the module bar
:
bar.cppm:6:22: error: default argument of 'is_comparable' must be imported from module 'foo' before it is required
void func() requires is_comparable<T> {}
^
foo.cppm:5:39: note: default argument declared here is not reachable
export template <class T, class Cat = partial> concept is_comparable = true;
^
1 error generated.
Metadata
Metadata
Assignees
Type
Projects
Status
Done