By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Visual C++ 7.1 INTERNAL COMPILER ERROR -- crossposted clc++ and microsoft.public.vstudio.general

P: n/a
// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
//
// Since I'm now using much time on reporting this compiler bug, please
// do also fix the __LINE__ macro.
//
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.
#include <vector>
#include <iostream>

template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};

template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}

T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};

template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >

// This is a bug. It causes a compiler crash. That is, an ICE.
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
};

int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60 };
static DoubleArray6 const xArray[] = { x };

Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem[i] << std::endl;
}
}

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"Alf P. Steinbach" <al***@start.no> schrieb im Newsbeitrag
news:40*****************@news.individual.net...
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.

I use the __LINE__ Macro a lot as integral constant parameter in my templates
(with VC7.1 as well) hence it is more than just curiosity:
which options do you refer to and which are the effects?

As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.

--
Regards,

Arne
Jul 22 '05 #2

P: n/a
* "Arne Adams" <ar********@t-online.de> schriebt:
"Alf P. Steinbach" <al***@start.no> schrieb im Newsbeitrag
news:40*****************@news.individual.net...
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.

I use the __LINE__ Macro a lot as integral constant parameter in my templates
(with VC7.1 as well) hence it is more than just curiosity:
which options do you refer to


Had to check that. One such option is "/ZI" (uppercase), edit-and-continue,
which is set by default in a Visual Studio project... Don't know others.

and which are the effects?
It does not generate new line numbers as it should; as I recall it does not
even generate line numbers.

For use in e.g. STATIC_ASSERT this is "fixed" by another bug (although not an
ICE), namely that VC allows multiple typedefs of same name as long as the
definitions are the same -- and for all that I know and care to check,
perhaps also when they are different.

For use in ScopeGuard the typedef bug does not "fix" the __LINE__ bug, so two
ScopeGuards or more in the same scope does not compile (I don't care to check
the details here either, perhaps it was that even one does not compile...
;-)). A workaround is to use the non-standard Microsoft __COUNTER__ macro.
But why should one have to special-case this compiler, always?

As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.


If the assumption is that the compiler will only ever be given correct code
then it can be optimized to an extreme degree.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #3

P: n/a
* "Arne Adams" <ar********@t-online.de> schriebt:

As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.


It is a crying shame that Microsoft provides no way to report a compiler
crash (ICE), except by _paying_ them to accept a report, then forgotten.

For the GNU compiler, OTOH., it's real easy: last time I reported an ICE
someone had fixed the bug and reported back within half an hour.

Microsoft: bug? What bug? We don't have any bugs -- to wit, nobody have
reported any bugs, especially not in our compilers (muu haa, evil laughter).

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #4

P: n/a

"Alf P. Steinbach" <al***@start.no> wrote in message
news:40*****************@news.individual.net...
* "Arne Adams" <ar********@t-online.de> schriebt:

As to syntax errors leading to ICEs in template code - that's nothing new for VC++.
It is a crying shame that Microsoft provides no way to report a compiler
crash (ICE), except by _paying_ them to accept a report, then forgotten.

For the GNU compiler, OTOH., it's real easy: last time I reported an ICE
someone had fixed the bug and reported back within half an hour.

Microsoft: bug? What bug? We don't have any bugs -- to wit, nobody

have reported any bugs, especially not in our compilers (muu haa, evil

laughter).

Anecdote: When I was doing telephone tech support for
several Microsoft compilers (back in the 80's), we were
prohibited from using the word 'bug' when talking to
customers. We were instructed to use the word 'problem',
and in some cases, 'feature'. :-)

-Mike
Jul 22 '05 #5

P: n/a
"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:r_*****************@newsread2.news.pas.earthl ink.net...

"Alf P. Steinbach" <al***@start.no> wrote in message
news:40*****************@news.individual.net...
* "Arne Adams" <ar********@t-online.de> schriebt:
>
> As to syntax errors leading to ICEs in template code - that's nothing new for > VC++.


It is a crying shame that Microsoft provides no way to report a compiler
crash (ICE), except by _paying_ them to accept a report, then forgotten.

For the GNU compiler, OTOH., it's real easy: last time I reported an ICE
someone had fixed the bug and reported back within half an hour.

Microsoft: bug? What bug? We don't have any bugs -- to wit, nobody

have
reported any bugs, especially not in our compilers (muu haa, evil

laughter).

Anecdote: When I was doing telephone tech support for
several Microsoft compilers (back in the 80's), we were
prohibited from using the word 'bug' when talking to
customers. We were instructed to use the word 'problem',
and in some cases, 'feature'. :-)

"To bug or not to bug... or is it a feature?
What was the question?"

--
Unforgiven

Jul 22 '05 #6

P: n/a
"Alf P. Steinbach" <al***@start.no> wrote in message
news:40*****************@news.individual.net...
// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
//
// Since I'm now using much time on reporting this compiler bug, please
// do also fix the __LINE__ macro.
//
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.
#include <vector>
#include <iostream>

template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};

template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}

T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};

template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >

// This is a bug. It causes a compiler crash. That is, an ICE.
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
};

int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60 };
static DoubleArray6 const xArray[] = { x };

Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem[i] << std::endl;
}
}

Your code does not compile under GCC:
Executing: C:\Program Files\ConTEXT\ConExec.exe
"c:\mingw\bin\g++.exe" -std=c++98 -pedantic-errors -O3 -Wall "temp.cpp" -o
temp

temp.cpp:44: error: ISO C++ forbids declaration of `VectorImpl' with no type
temp.cpp: In member function `int Vector<T>::VectorImpl(const T (&)[N])':
temp.cpp:44: error: only constructors take base initializers
temp.cpp:44: error: class `Vector<T>' does not have any field named
`VectorImpl
'
temp.cpp: At global scope:
temp.cpp: In instantiation of `Vector<main()::DoubleArray6>':
temp.cpp:53: instantiated from here
temp.cpp:39: error: base `VectorImpl<main()::DoubleArray6>' with only
non-default constructor in class without a constructor
temp.cpp: In function `int main()':
temp.cpp:53: error: no matching function for call to `
Vector<main()::DoubleArray6>::Vector(const main()::DoubleArray6[1])'
temp.cpp:39: error: candidates are:
Vector<main()::DoubleArray6>::Vector(const
Vector<main()::DoubleArray6>&)

Execution finished.


Regards,

Ioannis Vranos

Jul 22 '05 #7

P: n/a
"Ioannis Vranos" <iv*@guesswh.at.grad.com> wrote in message
news:c7***********@ulysses.noc.ntua.gr...


Your code does not compile under GCC:
Executing: C:\Program Files\ConTEXT\ConExec.exe
"c:\mingw\bin\g++.exe" -std=c++98 -pedantic-errors -O3 -Wall "temp.cpp" -o
temp

temp.cpp:44: error: ISO C++ forbids declaration of `VectorImpl' with no type temp.cpp: In member function `int Vector<T>::VectorImpl(const T (&)[N])':
temp.cpp:44: error: only constructors take base initializers
temp.cpp:44: error: class `Vector<T>' does not have any field named
`VectorImpl
'
temp.cpp: At global scope:
temp.cpp: In instantiation of `Vector<main()::DoubleArray6>':
temp.cpp:53: instantiated from here
temp.cpp:39: error: base `VectorImpl<main()::DoubleArray6>' with only
non-default constructor in class without a constructor
temp.cpp: In function `int main()':
temp.cpp:53: error: no matching function for call to `
Vector<main()::DoubleArray6>::Vector(const main()::DoubleArray6[1])'
temp.cpp:39: error: candidates are:
Vector<main()::DoubleArray6>::Vector(const
Vector<main()::DoubleArray6>&)

Execution finished.


And it indeed causes problem to the VC++ 7.1 compiler:

test.cpp(49): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more
information

Well you can contact Technical Support on this (also tell them to fix the
Start Page::Online Resources issue (works only for Administrator account in
my PC).


Regards,

Ioannis Vranos

Jul 22 '05 #8

P: n/a
* "Ioannis Vranos" <iv*@guesswh.at.grad.com> schriebt:
"Ioannis Vranos" <iv*@guesswh.at.grad.com> wrote in message
news:c7***********@ulysses.noc.ntua.gr...


Your code does not compile under GCC:

It should not, since it contains a bug at the line that says "bug".
And it indeed causes problem to the VC++ 7.1 compiler:

test.cpp(49): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more
information
Yep.
Well you can contact Technical Support on this (also tell them to fix the
Start Page::Online Resources issue (works only for Administrator account in
my PC).


It doesn't work at all on one PC.

Seems it has to do with national language support.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #9

P: n/a
"Alf P. Steinbach" <al***@start.no> wrote in message
news:40*****************@news.individual.net...
Well you can contact Technical Support on this (also tell them to fix the Start Page::Online Resources issue (works only for Administrator account in my PC).


It doesn't work at all on one PC.

Seems it has to do with national language support.

Meaning?


Regards,

Ioannis Vranos

Jul 22 '05 #10

P: n/a
* "Ioannis Vranos" <iv*@guesswh.at.grad.com> schriebt:
"Alf P. Steinbach" <al***@start.no> wrote in message
news:40*****************@news.individual.net...
Well you can contact Technical Support on this (also tell them to fix the Start Page::Online Resources issue (works only for Administrator account in my PC).


It doesn't work at all on one PC.

Seems it has to do with national language support.


Meaning?


Meaning I found several pages on the net with supposed fixes, involving
some language setting in Internet Explorer, which didn't work but have
worked for some others. It reminds of the old Class Wizard that only
worked properly with US English (and perhaps French or German) settings.
How is it even _possible_ to bring in an English dependency,
and how is it _possible_ to ignore such blatant bugs for years on end?

Follow-up to set to [microsoft.public.vstudio.general].

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #11

P: n/a
FWIW, the C1001 ICE doesn't occur when compiled with the Whidbey
compiler - it generates several compiler errors, starting with:

error C2143: syntax error : missing ')' before 'const'"

For this indicated incorrect line:
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}


Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Jul 22 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.