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

            Bug ID: 66243
           Summary: enum class value is allowed to be initialized by value
                    from other enum class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Predelnik at gmail dot com
  Target Milestone: ---

>From my understanding enum class values could be initialized by integer
constant expression (and thus by its own already defined values since they are
implicitly convertible to int in its scope). However g++ compiles the following
code where this value is taken from other completely unrelated enum class and
thus shouldn't be implicitly convertible to integer type in its scope.

enum class A
{
  X
};

enum class B
{
  X = A::X,
};

int main()
{
}

Reply via email to