Issue 182123
Summary clang 22 no longer accepts `constexpr` assignment of microsoft-cast
Labels clang
Assignees
Reporter ZacharyHenkel
    The following was accepted in clang 21 with `-fms-extensions -fms-compatibility` and is accepted in msvc natively.

```
int square(int num) {
    return num * num;
}

constexpr void* p = square;
```

Output:
```
<source>:6:21: warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
    6 | constexpr void* p = square;
```


In clang 22 rc2 Output:
```
<source>:6:21: warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
    6 | constexpr void* p = square;
      | ^~~~~~
<source>:6:17: error: constexpr variable 'p' must be initialized by a constant _expression_
    6 | constexpr void* p = square;
 |                 ^   ~~~~~~
<source>:6:21: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant _expression_
 6 | constexpr void* p = square;
      |                     ^
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to