[llvm-bugs] [Bug 51452] New: Namespace inline mismatch diagnostic refers to unhelpful previous definition

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 12 03:37:42 PDT 2021


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

            Bug ID: 51452
           Summary: Namespace inline mismatch diagnostic refers to
                    unhelpful previous definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tbaeder at redhat.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

See: https://godbolt.org/z/x87K78TnW

Take this C++ code:

1:  inline namespace abc {};
2:  namespace abc {};
3:  namespace abc {};

Clang will emit a warning for line 2, because the namespace is re-opened as
non-inline, while the previous definition was inline. It will add a Note for
the previous definition, in this case line 1.

However, it will also emit the same warning for line 3. In this case, it would
be helpful to have the Note refer to the definition in line 1, but it instead
refers to line 2. That is confusing since the problem is the inline mismatch,
but the Note refers to a definition that is not inline.

-- 
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/20210812/aa876e8f/attachment.html>


More information about the llvm-bugs mailing list