[LLVMbugs] [Bug 19216] New: bad diagnostic on conflicting forward declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 20 16:54:38 PDT 2014


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

            Bug ID: 19216
           Summary: bad diagnostic on conflicting forward declaration
           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

This has a great diagnostic:

namespace llvm {
  struct StringRef {};
}
namespace clang {
  struct StringRef;
  using llvm::StringRef;

  void f(StringRef sr);
}

x.cc:6:15: error: target of using declaration conflicts with declaration
already
      in scope
  using llvm::StringRef;
              ^
x.cc:2:10: note: target of using declaration
  struct StringRef {};
         ^
x.cc:5:10: note: conflicting declaration
  struct StringRef;
         ^
1 error generated.

We should do something like that when we have a forward declaration that
conflicts with a using declaration. Here's what we get instead:

x.cc:8:10: error: reference to 'StringRef' is ambiguous
  void f(StringRef sr);
         ^
x.cc:6:10: note: candidate found by name lookup is 'clang::StringRef'
  struct StringRef;
         ^
x.cc:5:15: note: candidate found by name lookup is 'clang::StringRef'
  using llvm::StringRef;
              ^
1 error generated.

That's confusing.

-- 
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/20140320/68d30cc9/attachment.html>


More information about the llvm-bugs mailing list