| Issue |
208100
|
| Summary |
[clang] Rejects valid deduced return type + template + module + header
|
| Labels |
|
| Assignees |
|
| Reporter |
davidstone
|
Given the following files:
header.hpp:
```c++
struct deduced {
template<typename = void>
auto operator()() const {
}
};
```
b.cpp
```c++
module;
#include "header.hpp"
export module b;
export template<typename T = void>
auto b() -> void {
deduced()();
}
```
```c++
#include "header.hpp"
import b;
auto a() -> void {
b();
}
```
clang rejects compiling `a.cpp` with
```console
/opt/compiler-explorer/clang-assertions-trunk/bin/clang++ --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 -MD -MT CMakeFiles/bug.dir/a.cpp.o -MF CMakeFiles/bug.dir/a.cpp.o.d @CMakeFiles/bug.dir/a.cpp.o.modmap -o CMakeFiles/bug.dir/a.cpp.o -c /app/a.cpp
In file included from /app/a.cpp:3:
b.cpp:9:11: error: function 'operator()<void>' with deduced return type cannot be used before it is defined
9 | deduced()();
| ^
a.cpp:6:2: note: in instantiation of function template specialization 'b<void>' requested here
6 | b();
| ^
header.hpp:3:7: note: 'operator()<void>' declared here
3 | auto operator()() const {
| ^
1 error generated.
```
See it live: https://godbolt.org/z/fW7KPnxYs
This was introduced by commit ff11bbce9e87ab4ef59a789cff1c9b9d771adc1e @mizvekov
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs