[cfe-dev] Clang issue MinGW STL alloc_traits.h error: in-class initializer for static data member is not a constant expression

Reid Kleckner rnk at google.com
Mon Jun 24 04:48:00 PDT 2013


On Mon, Jun 24, 2013 at 2:49 AM, Richard Smith <richard at metafoo.co.uk>wrote:

> On Sun, Jun 23, 2013 at 11:38 PM, Kim <soldoutseashell at gmail.com> wrote:
> >>What is _S_chk?
> >
> > _S_chk is a member function from a class in alloc_traits.h
> >
> >   template<typename _Alloc, typename _Tp>
> >     class __alloctr_rebind_helper
> >     {
> >       template<typename _Alloc2, typename _Tp2>
> >     static constexpr bool
> >            _S_chk(typename _Alloc2::template rebind<_Tp2>::other*)
> >     { return true; }
> >
> >       template<typename, typename>
> >         static constexpr bool
> >            _S_chk(...)
> >            { return false; }
> >
> >     public:
> >
> >     static const bool __value = _S_chk<_Alloc, _Tp>(nullptr);
> >     };
>
> OK, this is llvm.org/PR15651. Essentially, -fdelayed-template-parsing
> (which is enabled by default on some Windows targets) is currently
> incompatible with constexpr. -fno-delayed-template-parsing will
> probably help (if it doesn't cause breakage in other headers). I
> wonder if we should stop enabling -fno-delayed-template-parsing by
> default on MinGW -- MinGW's gcc presumably doesn't behave that way.


We don't enable -fdelayed-template-parsing when targetting mingw.  The
original invocation didn't specify an OS, so the triple defaulted to
...-win32.

You should use 'clang --target=i686-pc-mingw32' to get regular template
parsing and to match the small struct passing ABI, as well as other things
I can't recall.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130624/aef0912e/attachment.html>


More information about the cfe-dev mailing list