<div dir="ltr">My guess is that the proposal was written assuming a certain implementation of constexpr that never panned out.<br><br>It looks like both GCC and Clang expect constexpr member variables to be explicitly marked static:<br><br><pre style="color:rgb(0,0,0)">const.cpp:5:19: error: non-static data member 'f' declared 'constexpr'
   constexpr foo f{};
                   ^

(is GCC 4.9's diagnostic - for a simple non-template constexpr member variable)</pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 13, 2014 at 8:38 PM, 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">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>
produces error:<br>
//{=======================================<br>
/home/evansl/dwnlds/llvm/3.5/binary/clang+llvm-3.5.0-x86_64-linux-gnu/bin/clang++<br>
-c -O0 -g -stdlib=libc++  -std=c++14 -ftemplate-backtrace-limit=0<br>
-I/home/evansl/prog_dev/clang/libcxx<br>
-I/home/evansl/prog_dev/boost/sandbox/rw/non_variadic_templates<br>
-I/home/evansl/prog_dev/boost/sandbox/rw/sandbox/lje<br>
-I/home/evansl/prog_dev/boost/boost-releases/ro/boost_1_56_0<br>
-DTYPE_AT_IMPL=0   -ftemplate-depth=324  variable_templates.cpp -MMD -o<br>
/tmp/build/clangxx3_5_bin/clang/libcxx/variable_templates.o<br>
variable_templates.cpp:23:39: error: non-static data member cannot be<br>
constexpr; did you intend to make it static?<br>
    std::integral_constant<int,Value> constexpr<br>
                                      ^<br>
                                      static<br>
1 error generated.<br>
//}=======================================<br>
when compiled with the binary clang downloaded from:<br>
<br>
<br>
<a href="http://llvm.org/releases/3.5.0/clang+llvm-3.5.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz" target="_blank">http://llvm.org/releases/3.5.0/clang+llvm-3.5.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz</a><br>
<br>
and used on system:<br>
<br>
Linux lje-OptiPlex-9020 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28<br>
13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux<br>
<br>
The code is, AFAICT, essentially the same as the `struct<br>
matrix_measures' in section 3.2 of:<br>
<br>
  <a href="http://isocpp.org/files/papers/N3651.pdf" target="_blank">http://isocpp.org/files/papers/N3651.pdf</a><br>
<br>
Is this a clang bug or is the code somehow wrong?<br>
<br>
TIA.<br>
<br>
-regards,<br>
Larry<br>
<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>
</blockquote></div><br></div>