<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60036>60036</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            error: 'd<int>::d' from module 'd' is not present in definition of 'd<int>' in module 'd'
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          davidstone
      </td>
    </tr>
</table>

<pre>
    This was probably the hardest to reduce bug I've found yet. I suspect it can be reduced more but I don't know how.

The following set of translation units should be accepted:

```cpp
export module a;

export template<typename>
struct a;

template<typename T>
struct a<T &> {
        using type = char;
};
```

```cpp
export module b;

import a;

typename a<char &>::type;
```

```cpp
export module c;

import a;

typename a<char &>::type;
```

```cpp
export module d;

export template<typename>
struct d {
        d() {}
        explicit d(int) requires(true) {}
        d(auto &&) {}
};
```

```cpp
export module e;

import d;

auto r = d<int>();
```

```cpp
export module f;

import a;
import b;
import c;
import d;

template<typename T>
struct array {
        friend void fr(array<T> const &) {
        }
};

array() -> array<typename a<char &>::type>;

struct wrap {
        d<int> m;
};

template<typename T>
int f1(T) {
        return 1;
}

void f2() {
        d<int> view;
        int x = f1(view);
        typename a<decltype([x]{}) &>::type;
        wrap w;
}
```

```cpp
export module g;

import e;
import f;
```

But instead clang gives this error while compiling `g.cpp`:

```shell
In module 'e':
d.cpp:6:11: error: 'd<int>::d' from module 'd' is not present in definition of 'd<int>' in module 'd'
        explicit d(int) requires(true) {}
                 ^
d.cpp:5:2: note: declaration of 'd' does not match
        d() {}
        ^
d.cpp:6:11: note: declaration of 'd' does not match
        explicit d(int) requires(true) {}
                 ^
d.cpp:7:2: note: declaration of 'd' does not match
        d(auto &&) {}
        ^
d.cpp:4:8: note: declaration of 'd' does not match
struct d {
       ^
d.cpp:4:8: note: declaration of 'd' does not match
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.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