<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Can't pass ref-qualified function types to typeid, unless you do it in a template"
href="http://llvm.org/bugs/show_bug.cgi?id=19894">19894</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Can't pass ref-qualified function types to typeid, unless you do it in a template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider the following code:
template <class _Tp> struct split { typedef _Tp ptr; };
template <class _Tp, class _Up> struct split<_Tp _Up::*> { typedef _Tp ptr;
typedef _Up base; };
struct X {};
typedef split<void (X::*)() const>::ptr PMF;
#include <iostream>
#include <typeinfo>
template <typename T>
void print () { std::cout << typeid(T).name() << std::endl; }
int main () {
#ifdef FOO
std::cout << typeid(PMF).name() << std::endl;
#else
print<PMF>();
#endif
}
If you compile with clang++ -std=c++11 -DFOO, you get a compile error:
junk4.cpp:20:23: error: non-member function of type 'PMF' (aka 'void () const')
cannot have 'const' qualifier
std::cout << typeid(PMF).name() << std::endl;
but if you don't -DFOO, it compiles w/o error and prints: "KFvvE", which
demangles to "void () const".
Expectation: Either you should be able to pass this type to typeid() or not.
Washing it through a template should not "make it work".</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>