llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Assertion `FromType->isIntegralOrUnscopedEnumerationType()' failed when converting between scoped enums

Open pcc opened this issue 2 years ago • 3 comments

> cat test.ii
enum class a : int;
enum class b : int;

b x{a{}};
> ~/l/ra/bin/clang++ test.ii -std=c++17
clang: ../clang/lib/Sema/SemaOverload.cpp:424: clang::NarrowingKind clang::StandardConversionSequence::getNarrowingKind(clang::ASTContext &, const clang::Expr *, clang::APValue &, clang::QualType &, bool) const: Assertion `FromType->isIntegralOrUnscopedEnumerationType()' failed.

pcc avatar Mar 03 '22 00:03 pcc

@llvm/issue-subscribers-clang-frontend

llvmbot avatar Mar 03 '22 01:03 llvmbot

https://reviews.llvm.org/D120862

pcc avatar Mar 03 '22 02:03 pcc

This code is ill-formed and both gcc and clang currently reject this code and clang no longer seems to assert, see godbolt: https://godbolt.org/z/35MdP5EKv

Note defect report 2374

shafik avatar Oct 03 '22 17:10 shafik