<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 --- - Clang fails to match ObjC pointers to pointer template parameters under ARC"
href="http://llvm.org/bugs/show_bug.cgi?id=15865">15865</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang fails to match ObjC pointers to pointer template parameters under ARC
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>scoward@pivotallabs.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>Summary:
When ARC is enabled, C++ candidate templates' pointer template parameters fail
to match objective-C object pointers.
Steps to reproduce:
Compile the following main.mm file, with and without ARC:
#import <Foundation/Foundation.h>
template <typename T>
void testing(const T & whoCares) {
NSLog(@"================> Non pointer template");
}
template <typename T>
void testing(T * const & whoCares) {
NSLog(@"================> Pointer template");
}
int main(int argc, const char * argv[])
{
NSString *stringObject = @"hi";
char *cString = "abc";
testing(1);
testing(cString);
testing(stringObject);
testing<NSString>(stringObject);
return 0;
}
Expected Results:
The template with the pointer parameter should be instantiated for cString and
stringObject, without needing to parameterize the template explicitly, as
demonstrated by the output when compiled without ARC:
================> Non pointer template
================> Pointer template
================> Pointer template
================> Pointer template
Actual Results:
When ARC is enabled and the template is not parameterized explicitly, the
non-pointer template is instantiated if the pointer is an objective-c type, as
demonstrated by the output when compiled with ARC:
================> Non pointer template
================> Pointer template
================> Non pointer template <== WRONG
================> Pointer template</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>