<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 --- - C++98/03: Use of unnamed type fails to remove candidate"
href="http://llvm.org/bugs/show_bug.cgi?id=15265">15265</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C++98/03: Use of unnamed type fails to remove candidate
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>other
</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>hstong@ca.ibm.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>As per <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - C++98/03: Template arguments cannot be unnamed types"
href="show_bug.cgi?id=6784">Bug 6784</a>, unnamed types cannot be used as template arguments under
C++98/03. It appears that the result of the work done in the aforementioned bug
is to emit a warning.
The warning is not sufficient. In the small test case below, the incorrect
overload candidate is chosen by clang but not GCC.
### SOURCE:$ cat sfinaeOnTypeLinkage.cc
typedef enum { EE } *PtrE;
template <typename T>
char (*foo(T))[13];
char (*foo(void *))[42];
extern char check[sizeof *foo(PtrE(0))];
extern char check[42];
### ACTUAL:$ clang++ '-std=c++03' sfinaeOnTypeLinkage.cc -c && \
echo "(Clean compile)"
sfinaeOnTypeLinkage.cc:8:27: warning: template argument uses unnamed type
[-Wunnamed-type-template-args]
extern char check[sizeof *foo(PtrE(0))];
^~~
sfinaeOnTypeLinkage.cc:1:9: note: unnamed type used in template argument was
declared here
typedef enum { EE } *PtrE;
^
sfinaeOnTypeLinkage.cc:9:13: error: redefinition of 'check' with a different
type
extern char check[42];
^
sfinaeOnTypeLinkage.cc:8:13: note: previous definition is here
extern char check[sizeof *foo(PtrE(0))];
^
1 warning and 1 error generated.
### EXPECTED:$ g++ '-std=c++98' sfinaeOnTypeLinkage.cc -c && \
echo "(Clean compile)"
(Clean compile)
### BUILD INFORMATION:$ clang -v
clang version 3.2 (trunk 158227)
Target: i386-pc-cygwin
Thread model: posix</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>