[Bug c++/68957] New: Wrong overload resolution for unscoped enums with fixed underlying type

rs2740 at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 17 14:04:00 GMT 2015


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

            Bug ID: 68957
           Summary: Wrong overload resolution for unscoped enums with
                    fixed underlying type
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro:

#include <stdio.h>

enum E : char { e };

void f(char) { puts(__PRETTY_FUNCTION__); }
void f(int) { puts(__PRETTY_FUNCTION__); }

int main() {
    f(e);      // ambiguous
}

Before DR1601 (http://wg21.link/CWG1601), this should be ambiguous. After
DR1601, this should print 'void f(char)' because promotion to the underlying
type is preferred over promotion to the promoted underlying type.

GCC does neither and prints 'void f(int)' instead.


More information about the Gcc-bugs mailing list