[LLVMbugs] [Bug 13098] New: inherited operator= ambiguity in template function instantiation, but not in non-template function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 12 17:35:57 PDT 2012


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

             Bug #: 13098
           Summary: inherited operator= ambiguity in template function
                    instantiation, but not in non-template function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: xiphtheora at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8710
  --> http://llvm.org/bugs/attachment.cgi?id=8710
Test case that displays the error when ERROR is defined

Attached test case displays an ambiguity error when instantiating a function
template using an inherited operator= while the non-template version has no
ambiguity errors.

> clang++ --version
clang version 3.1 (branches/release_31)
Target: i386-pc-linux-gnu
Thread model: posix

(Also tested with SVN version 3.2)

> clang++ -o ambiguity ambiguity.cpp -DERROR
ambiguity.cpp:18:13: error: use of overloaded operator '=' is ambiguous (with
operand types 'Child' and 'int')
    Child() = 5;
    ~~~~~~~ ^ ~
ambiguity.cpp:26:15: note: in instantiation of function template specialization
'func1<int>' requested here
template void func1<int>();
              ^
ambiguity.cpp:5:12: note: candidate function
    Base & operator=(int) { return *this; }
           ^
ambiguity.cpp:6:12: note: candidate function
    Base & operator=(Base const &) { return *this; }
           ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list