[LLVMbugs] [Bug 19409] New: name lookup of virtual base class member through using-declarations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 11 18:38:54 PDT 2014


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

            Bug ID: 19409
           Summary: name lookup of virtual base class member through
                    using-declarations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Trevor_Smigiel at playstation.sony.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following test case, example 6 from n1543, generates an ambiguous name
lookup error on trunk.  Is generating an error correct?  It seems unambiguous
(according to standard section 10.2 and n1543) because I1::f and I2::f
designate the same virtual base class member B::f.

  struct B {
    void f();
  };
  struct I1: virtual B {
    using B::f;
  };
  struct I2: virtual B {
    using B::f;
  };
  struct D: I1, I2 {
    void g() {
      f(); // unambiguous
    }
  };

# clang --version
  clang version 3.5.0 (205993)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix

# clang -std=c++11 -c c.cpp
  c.cpp:13:9: error: member 'f' found in multiple base classes of different
types
        f(); // unambiguous
        ^
  c.cpp:6:14: note: member found by ambiguous name lookup
    using B::f;
             ^
  c.cpp:9:14: note: member found by ambiguous name lookup
    using B::f;
             ^
  1 error generated.

g++ 4.7 and 4.8 also generate an error for this case.  I did not test other
versions of gcc.

For reference:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#39
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1543.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1626.pdf

-- 
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/20140412/b4831a16/attachment.html>


More information about the llvm-bugs mailing list