<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 14, 2014 at 4:23 AM, Larry Evans <span dir="ltr"><<a href="mailto:cppljevans@suddenlink.net" target="_blank">cppljevans@suddenlink.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11/14/2014 12:48 AM, David Blaikie wrote:<br>
> My guess is that the proposal was written assuming a certain implementation<br>
> of constexpr that never panned out.<br>
><br>
> It looks like both GCC and Clang expect constexpr member variables to be<br>
> explicitly marked static:<br>
><br>
> const.cpp:5:19: error: non-static data member 'f' declared 'constexpr'<br>
>    constexpr foo f{};<br>
>                    ^<br>
><br>
> (is GCC 4.9's diagnostic - for a simple non-template constexpr member variable)<br>
><br>
</span>That's sad because, as n3651 says on pp. 2-3:<br>
<br>
  The main problems with “static data member” are:<br>
<br>
  • they require “duplicate” declarations: once inside the class<br>
    template, once outside the class template to provide the “real”<br>
    definition in case the constants is odr-used.<br></blockquote><div><br></div><div>then don't put it in a class.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
  • programmers are both miffed and confused by the necessity of<br>
    providing twice the same declaration. By contrast, “ordinary”<br>
    constant declarations do not need duplicate declarations.<br>
<br>
Also, the clang status page:<br>
<br>
  <a href="http://clang.llvm.org/cxx_status.html" target="_blank">http://clang.llvm.org/cxx_status.html</a><br>
<br>
reference n3651 below the section title:<br>
<br>
  C++14 implementation status<br>
<br>
Hence, I thought that's what clang implemented.<br>
<br>
In addition, the latest standard *draft*:<br>
<br>
  <a href="https://isocpp.org/files/papers/N3797.pdf" target="_blank">https://isocpp.org/files/papers/N3797.pdf</a><br>
<br>
contains the n3651 matrix_constants example on p. 313.<br>
<br>
Is there some more current standards document which requires the<br>
static qualifier on variable templates within a class?<br>
<br>
TIA.<br>
<br>
-regards,<br>
Larry<br>
<span class=""><br>
> On Thu, Nov 13, 2014 at 8:38 PM, Larry Evans <<a href="mailto:cppljevans@suddenlink.net">cppljevans@suddenlink.net</a>><br>
> wrote:<br>
><br>
>> The following code:<br>
>><br>
>> //{=======================================<br>
>> #include <type_traits><br>
>> struct variable_template<br>
>> {<br>
>>     template <int Value><br>
>>     std::integral_constant<int,Value> constexpr<br>
>>   value{}<br>
>>     ;<br>
>> };<br>
>> #include <iostream><br>
>> #include <iomanip><br>
>> int main()<br>
>> {<br>
>>     std::cout<<<br>
>>       variable_template::<br>
>>       value<1>()<<std::endl;<br>
>>     return 0;<br>
>> }<br>
>> //}=======================================<br>
</span>[snip]<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
</div></div></blockquote></div><br></div></div>