<html>
<head>
<base href="https://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 --- - Possible regression: "invalid explicitly-specified argument" on enum value as template parameter"
href="https://llvm.org/bugs/show_bug.cgi?id=27457">27457</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Possible regression: "invalid explicitly-specified argument" on enum value as template parameter
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>trprince@synopsys.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org, sig-rnd-sat-clang-bugs@synopsys.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Some time prior to clang 3.6.2, clang accepted the following snippet, but now
rejects it:
$ cat t.cpp
enum MyEnum { e };
class A {};
template <MyEnum> void foo(A) { }
#ifndef HIDE
template <int> void foo(int) { }
#endif
void bar() { foo<e>(A()); }
$
Clang 3.5:
$ clang-3.5 -v
clang version 3.5.2 (tags/RELEASE_352/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-3.5 -c t.cpp
$
Clang 3.6:
$ clang-3.6 -v
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-3.6 -c t.cpp
t.cpp:7:14: error: no matching function for call to 'foo'
void bar() { foo<e>(A()); }
^~~~~~
t.cpp:5:21: note: candidate function [with $0 = 0] not viable: no known
conversion from 'A' to 'int' for 1st argument
template <int> void foo(int) { }
^
t.cpp:3:24: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter
template <MyEnum> void foo(A) { }
^
1 error generated.
$
When the second template is omitted, both clang versions accept the snippet:
$ clang-3.5 -DHIDE -c t.cpp
$ clang-3.6 -DHIDE -c t.cpp
$
I can reproduce this with a recent svn build as well.</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>