[llvm-bugs] [Bug 46345] New: accept-invalid: values in out-of-line enum definition have the wrong scope

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 16 02:37:27 PDT 2020


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

            Bug ID: 46345
           Summary: accept-invalid: values in out-of-line enum definition
                    have the wrong scope
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sammccall at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Clang accepts this presumably-invalid code, which MSVC and GCC both reject
(https://godbolt.org/z/_r9y6q):

class Foo { enum PrivateEnum : char; };
enum Foo::PrivateEnum : char { A };
char Unrelated() { return A; }

Here the values of PrivateEnum are visible in the *lexical* scope of the
definition (the file) instead of the logical scope (the class Foo).

-- 
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/20200616/e86d2714/attachment.html>


More information about the llvm-bugs mailing list