<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:oneill+llvmbugs@cs.hmc.edu" title="M.E. O'Neill <oneill+llvmbugs@cs.hmc.edu>"> <span class="fn">M.E. O'Neill</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - constexpr function pointers aren't considered valid template arguments (violates [temp.arg.nontype])"
href="http://llvm.org/bugs/show_bug.cgi?id=18043">bug 18043</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - constexpr function pointers aren't considered valid template arguments (violates [temp.arg.nontype])"
href="http://llvm.org/bugs/show_bug.cgi?id=18043#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - constexpr function pointers aren't considered valid template arguments (violates [temp.arg.nontype])"
href="http://llvm.org/bugs/show_bug.cgi?id=18043">bug 18043</a>
from <span class="vcard"><a class="email" href="mailto:oneill+llvmbugs@cs.hmc.edu" title="M.E. O'Neill <oneill+llvmbugs@cs.hmc.edu>"> <span class="fn">M.E. O'Neill</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=18043#c1">comment #1</a>)
<span class="quote">> For more background, see:
>
> <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1570">http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1570</a>
>
> The code is ill-formed because 'fooAddr' does not refer to a function or an
> array (it refers to a pointer), and thus you cannot omit the '&'. (More
> generally, the intent was that C++11 did not let you do new things here,
> such as pushing the address through a constexpr variable.)</span >
>From my reading, that DR is about *subobjects*. This is not a subobject, so
the DR does not apply.
Also, note that your interpretation requires programmers to write this:
template <int x, int y, int z>
void foo()
{
}
template <void (*f)()>
void adapter1()
{
f();
}
template <void (*f)()>
void adapter2()
{
f();
}
template <void (*f)()>
void adapter3()
{
f();
}
void snafu()
{
adapter1<foo<1234567,31415,271828>>();
adapter2<foo<1234567,31415,271828>>();
adapter3<foo<1234567,31415,271828>>();
}
rather than store the desired parameterization of foo in a constexpr constant.
Also, it's hard to justify why you're reject the above code, but accept this
code
template <int x, int y, int z>
void foo()
{
}
template <void (*f)()>
void adapter1()
{
f();
}
template <void (*g)()>
void adapter2()
{
adapter1<g>();
}
void snafu()
{
adapter2<foo<1234567,31415,271828>>();
}
as g is also a pointer to a function, not the function itself.
So, at the very least you should be applying the rules you believe in
consistently.</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>