On Thu, Oct 15, 2009 at 11:24 AM, Ed Smith-Rowland <3dw...@verizon.net> wrote: > I was toying around with constexpr in the standard library and tripped on > this: > ------------------------------------------------------------------------------------------------------------ > // /bin/bin/g++ -std=c++0x -c template_constexpr.cpp > > template<typename T> > class A > { > static constexpr int foo() { return 666; } > }; > > template<typename E> > class B > { > static constexpr int foo() { return e.foo(); } // Should the compiler be > able to noodle this out?
invalid. > static constexpr int bar() { return E::foo(); } // Works fine. > private: > E e; > }; > > template_constexpr.cpp: In static member function 'static int B<E>::foo()': > template_constexpr.cpp:16:5: error: invalid use of member 'B<E>::e' in > static member function > template_constexpr.cpp:13:39: error: from this location > ------------------------------------------------------------------------------------------------------------ > > Question, if you can use a member access operator to access a static member, > shouldn't constexpr work through that method too? only after all other semantics restrictions are met, BTW: current 'constexpr' is preliminary. There is more to come -- patch under review. > > Thanks, > > Ed Smith-Rowland > >