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

    <tr>
        <th>Summary</th>
        <td>
            Can't decltype outer class' member if inner has a templated base
        </td>
    </tr>

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

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

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

<pre>
    ```c++
template<typename T> class base {};

struct outer {
        int member;
        
        template<typename T>
        struct inner : base<T>
        {
                void fn()
                {
                        decltype(outer::member) var1;
                        decltype(&outer::member) var2;
                        decltype(outer().member) var3;
                }
        };
};

template void outer::inner<int>::fn();
```
-> error: 'outer::member' is not a member of class 'outer::inner<int>'

https://godbolt.org/z/5Kxhq5YfG

I admittedly don't know if the above code is valid C++, but considering var2 and var3 work, and it also compiles if I change base<T> to base<int>, this is, at minimum, a misleading error message.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U8GSmzAM_Rpz8WyGGAjhwCGbbTs7vfbSo8EC3DV2aptst19f2YEsSbudESTCetLTk9wY8VaTXXqxlrDHYOkTSQ8expPiHkh29G8n0HwE-o1kn2iruHO04Q4oKR9J-USyGXJ5O2-n1lMzebAxYj6rpPZ0hLEBu0JU1z8fFbwGzIml1iFxdogcMPomaF0Q7WykoJ0mbE9YtT64i0MT0KpQGGMjd6yANhNmFT1zu70lfocibPcRkP0XeEFFipsbWHYPQ7HfG10J_9cQFjFpFGBFK6qHouEwgmzx21Wfa45lIy7uQxg7WGtCDkpY-Y82Syod1cZTPs-Ymm5elVvAHQFWrmkP3p9ciGOf0XojGqP8xtgevd_4FF9_DT-L792XNeiZcjFK70GoNyoMNlN6-qLNK5Ud9QNQ3pgz0NYICCTPXKEkx3nX2ZE2k8dD7aQAK3Uf50W5FnEC9NXYlxAVPkhsTzmD0eNJKnChwDNtB657WG8j9WZxlzaPyASLSxdz4UWQWo7TGD10nAIuQvEoM0roHO9hk4g6E1VW8cRLr6A-8kt3y_LMtyzqHGYwS4-0Lrdk4A7TL8sgIqlksqq-E1r6YWo22BY6Sp2Xn4eTNT-g9ehK5yZwYQTFfsuSoe74nvOqaFpWdl2Xp_utyCFPy07kvNsBJIo3oFxNikdSPCWyZilj6S7dbou8LNgmZXmWdmUquKjalLUkT2HkUm1C4TDyxNaRQzP1Dg-VdN69H2LDstcAS34--cHY-qBabk0S2daR6h8fCXVo">