https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105824

            Bug ID: 105824
           Summary: Accepts invalid issue with implicit conversion of a
                    scoped enumeration type
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aaron at aaronballman dot com
  Target Milestone: ---

Consider the following code:
```
enum class E1 {
  Val1 = 1L
};

int p1[E1::Val1];
int *p2 = new int[E1::Val1];

```
GCC correctly diagnoses the declaration of p1 because E1::Val1 cannot be
implicitly converted to an integer type, but does not diagnose the new
expression which initializes p2 despite it requiring the same implicit
conversion.

Other compilers diagnose both p1 and p2: https://godbolt.org/z/Pd6dhdxxa

Reply via email to