-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Clang incorrectly complains about default template argument not being reachable #66255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-modules
Run a compiler on this code:
```cpp
// --- foo.cppm
export module foo;
export struct partial {}; // --- bar.cppm import foo;
Expected results: code compiles with no errors. 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. |
@llvm/issue-subscribers-c-20
Run a compiler on this code:
```cpp
// --- foo.cppm
export module foo;
export struct partial {}; // --- bar.cppm import foo;
Expected results: code compiles with no errors. 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. |
I believe this particular bug is only applicable to older Clang versions (definitely present in clang 14). But we are seeing a similar issue with a generated module map we're using for libc++, I will keep this issue open for a few days while I'm trying to get a reduced reproducer. |
@ilya-biryukov can we close? |
Run a compiler on this code:
The exact commands are:
Expected results: code compiles with no errors.
Actual: Clang produces the following error when compiling the module
bar
:The text was updated successfully, but these errors were encountered: