Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Today's ICE for Visual C++ 2015, a SFINAE-thingy.

35 views
Skip to first unread message

Alf P. Steinbach

unread,
Dec 23, 2015, 3:49:20 PM12/23/15
to
https://connect.microsoft.com/VisualStudio/feedback/details/2163090/internal-compiler-error-on-some-sfinae-code

Code that crashes the Visual C++ 2015 update 1 compiler, written for a
Stack Overflow answer, (http://stackoverflow.com/a/20819867/464581):


<code>
#ifndef DO_BAD
# define DO_GOOD
#endif

#include <iostream>

template< class A, class B > struct Is_t_;

template< class Type > struct Is_t_<Type, Type> { using T = void; };

template< class A, class B >
using If_is_ = typename Is_t_<A, B>::T;

struct Bad_string
{
operator const char* () const { return "666!"; }
Bad_string( char const* = 0 ) {}
};

auto operator==( Bad_string const&, Bad_string const& )
-> bool
{ return true; }

struct Good_string
{
template< class Type, class Enabled_ = If_is_<const char*, Type>>
operator Type() const { return "42 :)"; }

Good_string( char const* = 0 ) {}
};

auto operator==( Good_string const&, Good_string const& )
-> bool
{ return true; }

#if defined( DO_GOOD )
using String = Good_string;
#elif defined( DO_BAD )
using String = Bad_string;
#else
# error "Define either DO_GOOD or DO_BAD, please."
#endif

auto main() -> int
{
String a, b;
(void) (a == "alfalfa"); // Errs for Bad_string
(void) (a + 1); // Compiles for Bad_string.
}
</code>


Compiler response:


<quote>
foo.cpp(26): fatal error C1001: An internal error has occurred in the
compiler.
(compiler file 'msc1.cpp', line 1421)
To work around this problem, try simplifying or changing the program
near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Internal Compiler Error in D:\installed\Microsoft Visual Studio
14.0\VC\BIN\cl.exe. You will be prompted to send an err
or report to Microsoft later.
</quote>


I think reporting one or two compiler bugs each week is ridiculous.

Still.

- Alf

Paavo Helde

unread,
Dec 23, 2015, 4:22:13 PM12/23/15
to
"Alf P. Steinbach" <alf.p.stein...@gmail.com> wrote in
news:n5f175$oij$1...@dont-email.me:
> Internal Compiler Error in D:\installed\Microsoft Visual Studio
> 14.0\VC\BIN\cl.exe. You will be prompted to send an err
> or report to Microsoft later.
> </quote>
>
>
> I think reporting one or two compiler bugs each week is ridiculous.

Why? If nobody is reporting, the bugs don't get fixed.

I have reported a couple of MSVC bugs, and IIRC they got fixed in few years
already!

Cheers
Paavo

Bo Persson

unread,
Dec 24, 2015, 5:46:31 AM12/24/15
to
On 2015-12-23 22:21, Paavo Helde wrote:
> "Alf P. Steinbach" <alf.p.stein...@gmail.com> wrote in
> news:n5f175$oij$1...@dont-email.me:
>> Internal Compiler Error in D:\installed\Microsoft Visual Studio
>> 14.0\VC\BIN\cl.exe. You will be prompted to send an err
>> or report to Microsoft later.
>> </quote>
>>
>>
>> I think reporting one or two compiler bugs each week is ridiculous.
>
> Why? If nobody is reporting, the bugs don't get fixed.
>

Some of us might have expected an Update 1 to have fewer bugs than the
initial release. :-)


Bo Persson


woodb...@gmail.com

unread,
Dec 24, 2015, 11:08:52 AM12/24/15
to
I bought a newspaper a few weeks ago and one of the three
sections was missing. I don't recall that happening
previously. I didn't catch the problem until after I
got home. Now I'm more careful to make sure everything
is kosher before I buy it.

Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net

Alf P. Steinbach

unread,
Dec 25, 2015, 7:13:26 AM12/25/15
to
Well, this one's already fixed (as a result of the reporting), and
closed, but we'll not see the fix until some new update or release.

Cheers,

- Alf

0 new messages