[all-commits] [llvm/llvm-project] d6b659: [clang] Fix implicit integer conversion for opaque...
thebrandre via All-commits
all-commits at lists.llvm.org
Fri Jan 10 07:32:19 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d6b6598e8075a5ba0271ee06a20c5a5609c0ec37
https://github.com/llvm/llvm-project/commit/d6b6598e8075a5ba0271ee06a20c5a5609c0ec37
Author: thebrandre <andre.brand at mailbox.org>
Date: 2025-01-10 (Fri, 10 Jan 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
A clang/test/SemaCXX/opaque-enum-declaration-in-class-template.cpp
Log Message:
-----------
[clang] Fix implicit integer conversion for opaque enums declared in class templates (#121039)
This commit fixes issues with enumeration types instantiated from an
opaque-enum-declarations
(see [dcl.enum]) in class templates broke basic assumptions during
parsing of arithmetic
expressions due to absent (NULL TYPE) promotion types of instances of
EnumDecl.
To this end, we repeat the simple steps in `Sema::ActOnTag` to evaluate
the promotion type
of a fixed enumeration based on its underlying type (see C++11
[conv.prom] p4).
Note that if, instead, a full *enum-specifier* (subsequent curly braces)
is provided,
`Sema::ActOnEnumBody` is re-invoked on template instantiation anyway
overriding the
promotion type and hiding the issue. This is analog to how enumerations
declarations
outside of template declarations are handled.
Note that, in contrast to `Sema::ActOnEnumBody`, `Sema::ActOnTag` is
*not* called again
for the instantiated enumeration type.
Fixes #117960.
---------
Co-authored-by: cor3ntin <corentinjabot at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list