<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 --- - Clang does not allow to use constexpr type conversion in non-type template argument"
href="https://llvm.org/bugs/show_bug.cgi?id=25693">25693</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang does not allow to use constexpr type conversion in non-type template argument
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>petr@kalinin.nnov.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider the following code:
struct A {
constexpr operator int() const { return 42; }
};
template <int>
void foo() {}
void test(const A& value) {
foo<value>();
}
int main() {
A a{};
test(a);
}
Coliru's Clang 3.7.0 with -std=c++14 rejects it
(<a href="http://coliru.stacked-crooked.com/a/c73bdb68b7e33c38">http://coliru.stacked-crooked.com/a/c73bdb68b7e33c38</a>) with the following
error:
main.cpp:9:5: error: no matching function for call to 'foo'
foo<value>();
^~~~~~~~~~
main.cpp:6:6: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter
void foo() {}
While Coliru's GCC 5.2.0 compiles it fine.
-----
This is based on this question:
<a href="http://stackoverflow.com/questions/33872039/invalid-explicitly-specified-argument-in-clang-but-successful-compilation-in-gcc">http://stackoverflow.com/questions/33872039/invalid-explicitly-specified-argument-in-clang-but-successful-compilation-in-gcc</a></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>