[clang] [clang] Fix issue #117960 (PR #121039)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 31 03:19:16 PST 2024


thebrandre wrote:

Thanks for the feedback @cor3ntin! 🙂

I will change the title of the PR and of the commit message to: 

> _[clang] Fix implicit integer conversion for opaque enum declarations in class templates_ 

adopting the terminology from [[dcl.enum]](https://wg21.link/dcl.enum) if that isn't too verbose?

The other potential issues you mentioned should actually conform to the specification in [[temp.spec.general]](https://wg21.link/temp.spec#temp.inst-3) if I understand it correctly.
See here on Compiler Explorer: [https://godbolt.org/z/GzYq9jzjo](https://godbolt.org/z/GzYq9jzjo).
This behavior is also consistent with GCC.

My changes should not affect the behavior if `ActOnEnumBody` is called. Admittedly, I was very conservative when changing behavior because I am not yet very familiar with the codebase.
Do you think, we should still pursue the idea of refactoring as you described if the current behavior of Clang turns out to be correct in the situations you brought up? I'd be happy to do so. But I am not sure if it belongs into this PR? It definitely makes sense to add regression tests for this scenario if they don't already exist.

In any case, I'll try if I can find any other related scenarios where the fix isn't sufficient!


https://github.com/llvm/llvm-project/pull/121039


More information about the cfe-commits mailing list