| Issue |
107673
|
| Summary |
Seemingly incorrect treatment of constexpr member functions in modules
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
kamrann
|
According to the standard, member functions defined within a class definition are implicitly `inline` in the global module, but not so within a module purview. However, the standard also states that `constexpr` member functions are implicitly inline, and in this case makes no exception for modules.
[11.4.2/1 [class.mfct] - see also Note 1](https://eel.is/c++draft/class.mfct#1)
[9.2.6/1 [dcl.constexpr]](https://eel.is/c++draft/dcl.constexpr#1)
As such all `constexpr` member functions should be `inline`, regardless of modules. From what I can see, clang is not respecting this. I'm seeing linker errors for such member functions when using modules with shared libraries.
I believe the difference between clang and gcc [seen here](https://godbolt.org/z/GGW1fjMT1) is fundamentally the cause. Clang is generating code for a function marked `constexpr` but not for one marked `inline constexpr`, yet if I'm interpreting the standard correctly these cases should be equivalent.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs