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

    <tr>
        <th>Summary</th>
        <td>
             error: non-type template argument is not a constant expression with 32-bit address space
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following C++ code is not compiled with clang x86-64 v17.0.1 with MS extensions enabled, while it compiles successfully with X86 msvc v19.  
Steps to reproduce:

1.  cat test.cpp
```
typedef void                OpcUa_Void;

typedef OpcUa_Void (*__ptr32 PfnClear)(OpcUa_Void* __ptr32);

template<class T, PfnClear fctClear>
class UaStackTypeArray
{};

OpcUa_Void ClearNothing(void* __ptr32);

template class UaStackTypeArray<bool, ClearNothing>;

```
2. clang test.cpp -S -fms-extensions
```
test.cpp:12:39: error: non-type template argument is not a constant expression
   12 | template class UaStackTypeArray<bool, ClearNothing>;
      | ^~~~~~~~~~~~
test.cpp:12:39: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
1 error generated.
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklM2OozgQgJ_GXEpBYJIABw4k3bntj9Q9q721jF2Ad42N7CLdueyzr4Bk0hvNjkYaK3KAqvpcfy4Rgu4sYsV2B7Z7isREvfOV8MIP2mLUOHWpXnuE1hnj3rXt4Mj4gfEDSKcQdADrCKQbRm1QwbumHqQRtoOPYr_Zb-Gc5nESp6vklxfAD0IbtLMB0IrGoGL8CO-9Ngj6KylAmKTEENrJmMtq_GexhyGcJZzTMgZgyRNL6hfCMQA58Dh6pyaJLKtX0bqnMYAUBISBYjmOV9k-uf6WV7qMqLCFs9MKHtZvo_wi3v5wWrHs8Jl8M7orAOMF4_Xb20g-4_B7a48GhWe8ZLz4xOE1XHVm0QMVh9EIQpYdpREhwOucnxsKWkkrM3te9VelL-KFhPz79TJi7b24XIn5geVPDwd8cnch_eqo17ZjvDj_qG_wP4dmx8Y5M_v7H3L2_MB5yD6Pry1zqxFsXmDTDmFzb5Zvl-1W06xOOcvqrGRZDei98_ODdXYzFwm--i18Nw1o6da3AqSzgYQlwI_RY5jPWtkAkHJg-RF-Puq1kWYW2z3_c1_fi8K6uQdqkCIQUC8IRvSt80MA6nH2-4x-vUeuBQEetSX0o0d6W2xuIc73FhVo-71o0zVr0KFFLwhV_M2Er3ukqkyVWSkirNI8KXY84dsk6qsmT7d5kbRJrookkeVWpGWzV8kuw2wr0zzS1aLKeZryXc6TuOVCNSKXKIqWq6Jk2wQHoU1szHmIne8iHcKEVcG3ZRIZ0aAJy6zi3OI7LELG-Ty6fDXbbJqpC2ybGB0o3CmkyWD1062xDqKMbxpNIJSaP0MYhcRo8qbqicYwzx9-YvzUaeqnJpZuYPw0e3L924ze_YWSGD8t_gfGT0t8_wYAAP__Gm3AMA">