[dune-functions] More build failures
Christian Engwer
christian.engwer at uni-muenster.de
Fri Sep 18 15:19:43 CEST 2015
On Fri, Sep 18, 2015 at 01:59:58PM +0200, Carsten Gräser wrote:
> Hi,
>
> [...]
> > Ups, you are right... but the error is still the same
> > in-class initializer for static data member is not a constant expression
> > static const int value = ((const typename std::decay<T>::type*)(nullptr))->size();
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> it's really hard to call a constexpr method if you don't
> have an object. After digging some more time it seems that
> the only possible way is to call a constructor inside of
> decltype. Unfortunately the constructor arguments are not
> known. Maybe it's OK to restrict this to default-constructible
> types. I'll have look.
After discussing with Jö, we agreed that it is necessary to have
default constructible types. casting from a null ptr and then calling
a member is undefined behaviour. On the other hand we can safely
assume that all types we want to pass are either std::array or
somethingin our scopte. Thus we can always make sure that they are
default constructible.
With this assumption the code got a lot simpler and I pushed a fix
which works with clang and g++.
Ciao
Christian
More information about the dune-functions
mailing list