Boost logo

Boost :

Subject: Re: [boost] Patch bonanza for VS2013 Preview support
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2013-07-24 18:45:45


[STL]
> Hmm. VC rejects this code:
>
> C:\Temp>type purr.cpp
> template <typename T> struct NoCharsAllowed {
> static_assert(sizeof(T) > 1, "No chars allowed!");
> };
>
> template <typename A> void purr(int, const A&);
>
> template <typename B, typename... Types> typename NoCharsAllowed<B>::type purr(void *, const B&, Types...);
>
> int main() {
> purr(1729, 'x');
> }
>
> C:\Temp>cl /EHsc /nologo /W4 /c purr.cpp
> purr.cpp
> purr.cpp(2) : error C2338: No chars allowed!
> purr.cpp(10) : see reference to class template instantiation 'NoCharsAllowed<char>' being compiled
>
> However, GCC accepts it, contrary to my understanding of the Standard.

More curiously (according to our compiler team; I haven't run clang myself):

VC 2013: static_assert
GCC 4.8.1: accepts
EDG 4.6: accepts
clang 3.3: static_assert

STL


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk