[LLVMbugs] [Bug 11942] New: Hidden type name causes confusion
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Feb 7 15:04:31 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11942
Bug #: 11942
Summary: Hidden type name causes confusion
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: chris at bubblescope.net
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following comes from reducing an example which used std::map iterators. The
code below produces the following error message:
-----------------
t.cc:24:7: error: invalid operands to binary expression
('MyBase<MyMap>::base_iterator' (aka 'P<typename MyMap::type>') and 'P<int>')
*it == p;
~~~ ^ ~
t.cc:6:6: note: candidate template ignored: deduced conflicting types for
parameter 'T' ('const int' vs. 'int')
void operator==(const P<T>&, const P<T>&)
-----------------
Notice the 'aka' doesn't actually tell us the type, so we still don't really
know what the problem is. In this case, the 'note' is quite helpful, but in
other cases is less useful. Should the 'aka' aim to give the "real type" of the
expression?
Code example:
template<typename T>
struct P
{ };
template<typename T>
void operator==(const P<T>&, const P<T>&)
{ };
template<typename M>
struct MyBase
{ typedef P<typename M::type> base_iterator; };
struct MyMap
{
typedef const int type;
typedef MyBase<MyMap>::base_iterator* iterator;
};
int main(void)
{
MyMap::iterator it;
P<int> p;
*it == p;
}
--
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