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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] `portability-template-virtual-member-function` triggers on constexpr member accesses
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    I'm not really sure this is a bug, but it's a weird edge case that felt worth bringing up.
```cpp
#include <fstream>

void test(void) {
 std::ofstream stream{"dummy", std::wofstream::trunc};
}
```
Note that the mode is set using `std::wofstream`, *not* `std::ofstream`.

Running clang-tidy 20.1.0 on a Windows system gives me the following warning:
```
PS P:\test> clang-tidy .\test.cpp --checks=portability-template-virtual-member-function
Error while trying to load a compilation database:
Could not auto-detect compilation database for file ".\test.cpp"
No compilation database found in P:\test\. or any parent directory
fixed-compilation-database: Error while opening fixed database: no such file or directory
json-compilation-database: Error while opening JSON database: no such file or directory
Running without flags.
32 warnings generated.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\fstream:283:24: warning: unspecified virtual member function instantiation; the virtual member function is not instantiated but it might be with a different compiler [portability-template-virtual-member-function]
  283 | __CLR_OR_THIS_CALL ~basic_ofstream() noexcept override {}
      | ^
P:\test\.\test.cpp:4:40: note: template instantiated here
 4 |     std::ofstream stream{"dummy", std::wofstream::trunc};
      | ^
Suppressed 31 warnings (31 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
```
This feels a bit unintuitive to me, since I'm never actually using a `std::wofstream` object, it doesn't feel like the best diagnostic.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVkFv2zgT_TX0ZSBBpiTLOfjgKA2-fui2RdPtHgOKHElsKVIgh3Z92d--oOw0TtEAW2CF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