[llvm-bugs] [Bug 42247] New: Diagnostic missing for redefinition

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 12 01:29:02 PDT 2019


            Bug ID: 42247
           Summary: Diagnostic missing for redefinition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                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

My clang is 9.0.0, and the code is:

class foo {
  typedef int bar;

class baz {
  foo::bar foo;

clang accepts with any warning messages. Although a diagnostic is not strictly
required by the standard (§3.3.6, basic.scope.class), but would be very useful.

The code comes from a gcc bug report:


gcc 10.0.0 rejects the code:

error: declaration of ‘foo baz::foo’ changes meaning of ‘foo’ [-fpermissive]
    9 |  foo foo;
      |      ^~~
note: ‘foo’ declared here as ‘class foo’
    1 | class foo {
      |       ^~~

Shall clang present similar warning messages?

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/20190612/071e16f2/attachment.html>

More information about the llvm-bugs mailing list