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

            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: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

My clang is 9.0.0, and the code is:

class foo {
public:
  typedef int bar;
};

class baz {
public:
  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:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28513

gcc 10.0.0 rejects the code:

error: declaration of ‘foo baz::foo’ changes meaning of ‘foo’ [-fpermissive]
    9 |  foo foo;
      |      ^~~
/home/haozhong/project/approach/compilerpara/gcc/tmp/gcc_28513/code1.c.cpp:1:7:
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to