pcc created this revision.
pcc added a reviewer: rsmith.
Herald added a project: All.
pcc requested review of this revision.
Herald added a project: clang.

Fixes pr54158.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120862

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/SemaCXX/cxx17-enum-scoped.cpp


Index: clang/test/SemaCXX/cxx17-enum-scoped.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/cxx17-enum-scoped.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++17 -verify -triple 
x86_64-apple-darwin %s
+
+// expected-no-diagnostics
+
+namespace PR54158 {
+  enum class A : int;
+  enum class B : int;
+  B x{A{}};
+}
Index: clang/lib/Sema/SemaOverload.cpp
===================================================================
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -420,7 +420,7 @@
   //    value when converted back to the original type.
   case ICK_Integral_Conversion:
   IntegralConversion: {
-    assert(FromType->isIntegralOrUnscopedEnumerationType());
+    assert(FromType->isIntegralOrEnumerationType());
     assert(ToType->isIntegralOrUnscopedEnumerationType());
     const bool FromSigned = FromType->isSignedIntegerOrEnumerationType();
     const unsigned FromWidth = Ctx.getIntWidth(FromType);


Index: clang/test/SemaCXX/cxx17-enum-scoped.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/cxx17-enum-scoped.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++17 -verify -triple x86_64-apple-darwin %s
+
+// expected-no-diagnostics
+
+namespace PR54158 {
+  enum class A : int;
+  enum class B : int;
+  B x{A{}};
+}
Index: clang/lib/Sema/SemaOverload.cpp
===================================================================
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -420,7 +420,7 @@
   //    value when converted back to the original type.
   case ICK_Integral_Conversion:
   IntegralConversion: {
-    assert(FromType->isIntegralOrUnscopedEnumerationType());
+    assert(FromType->isIntegralOrEnumerationType());
     assert(ToType->isIntegralOrUnscopedEnumerationType());
     const bool FromSigned = FromType->isSignedIntegerOrEnumerationType();
     const unsigned FromWidth = Ctx.getIntWidth(FromType);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to