[llvm-bugs] [Bug 34658] New: Class typedef shadowing a name from outside the class

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 18 09:34:24 PDT 2017


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

            Bug ID: 34658
           Summary: Class typedef shadowing a name from outside the class
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brycelelbach at gmail.com
                CC: llvm-bugs at lists.llvm.org

Clang accepts this code: https://wandbox.org/permlink/BlhRVaLeR91drp6O

But, [basic.scope.class] p5 of the C++ standard suggests it shouldn't:

  typedef int I;
  class D {
      typedef I I; // error, even though no reordering involved
  };

A colleague suggested that [basic.scope.class] p2 may be relevant as well: "A
name N used in a class S shall refer to the same declaration in its context and
when re-evaluated in the completed scope of S. No diagnostic is required for a
violation of this rule" (does this indicate that it's ill-formed but NDR?).

GCC rejects this: https://wandbox.org/permlink/1voYu1uVpGggY8W9.

Is this code ill-formed? Should Clang reject it?

-- 
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/20170918/b6c1adfd/attachment.html>


More information about the llvm-bugs mailing list