[LLVMbugs] [Bug 19427] New: clang does not diagnose declaration of name inside class scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 14 11:43:59 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19427

            Bug ID: 19427
           Summary: clang does not diagnose declaration of name inside
                    class scope
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Testcase:

namespace ns {
 class Module { };
}

namespace ns {
class Module;

class Foo {
 Module *Module;
};
}

Clang issues no error. GCC says:

a.cc:9:11: error: declaration of ‘ns::Module* ns::Foo::Module’ [-fpermissive]
  Module *Module;
          ^
a.cc:2:9: error: changes meaning of ‘Module’ from ‘class ns::Module’
[-fpermissive]
  class Module { };
        ^

GCC is correct. This is invalid per [basic.scope.class]/1 bullet 2. This is
NDR, but gcc diagnoses it, and it shouldn't be inefficient for us to do the
same (we need to do a name lookup on newly declared names anyways).

-- 
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/20140414/c2f7e982/attachment.html>


More information about the llvm-bugs mailing list