| Issue |
164466
|
| Summary |
Modules: implicitly exported template class is deemed incomplete at the point of instantiation if defined in a different partition
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
PiliLatiesa
|
p1.cpp
``` cpp
export module m:p1;
template<typename>
class Incognita;
export template<typename T>
class Variable
{
public:
Incognita<T> foo() const { return {*this}; }
};
```
p2.cpp
```cpp
export module m:p2;
import :p1;
template<typename T>
class Incognita
{
public:
Incognita(const Variable<T> &) {}
};
```
m.cpp
```cpp
export module m;
export import p1;
export import p2;
```
example.cpp
```cpp
import m;
int main()
{
Variable<double> x;
auto bar = x.foo();
}
```
```
example.cpp:7:14: error: implicit instantiation of undefined template 'Incognita<double>'
7 | auto bar = x.foo();
| ^
p1.cpp:4:7: note: template is declared here
4 | class Incognita;
| ^
p1.cpp:11:16: error: implicit instantiation of undefined template 'Incognita<double>'
11 | Incognita<T> foo() const { return {*this}; }
| ^
example.cpp:7:14: note: in instantiation of member function 'Variable<double>::foo' requested here
7 | auto bar = x.foo();
| ^
p1.cpp:4:7: note: template is declared here
4 | class Incognita;
| ^
p1.cpp:11:37: error: implicit instantiation of undefined template 'Incognita<double>'
11 | Incognita<T> foo() const { return {*this}; }
| ^
p1.cpp:4:7: note: template is declared here
4 | class Incognita;
| ^
```
https://godbolt.org/z/naq543aqW
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs