[llvm-bugs] [Bug 35401] New: Inconsistency: enumerator name is found only if not qualified

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 23 11:42:12 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35401

            Bug ID: 35401
           Summary: Inconsistency: enumerator name is found only if not
                    qualified
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jenda.tusil at gmail.com
                CC: llvm-bugs at lists.llvm.org

This code does compile. If we replace (1) with (2), it does compile, which is
weird and likely wrong.

namespace N { enum E : int; }
enum N::E : int {A,B};

int bar() {
    //return int(::A); // 1
    return int(A); // 2
}

Clang reject the commented line in function bar(), but accepts the line below.
I think it should either accept both or reject both. Gcc does reject both. 

However, maybe compilers should accept both lines, because N4296 says in
7.2/11:
> Each enum-name and each unscoped enumerator is declared in the scope that
> immediately contains the enum-specifier.
which is to global scope.

The problem originally appeared in this SO question:
https://stackoverflow.com/q/47383199/6209703

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171123/41576856/attachment.html>


More information about the llvm-bugs mailing list