473,714 Members | 3,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[BUG] ICE cause by template class with constructor-like declaration with name of different class and template const parameters

This was posted by someone in comp.lang.c++, and later in
microsoft.publi c.vstudio.gener al, but since I know Carl is in this group,
and he's the one that should read this, I've reposted it here. I've also
minimalised the code that causes the bug.

The bug is that the following syntax causes an Internal Compiler Error. The
code is not correct, but should produce a warning or error message, not an
ICE. It occurs when a template class mistakenly names its constructor after
a different class, and in addition uses a template type parameter followed
by 'const'. See 'example below'. The code is complete.

----CODE SAMPLE----
class SomeClassA
{
};

template<typena me X>
class SomeClassB
{
public:
SomeClassA(X const &n) { }; // *
};

int main()
{
return 0;
}
----END CODE SAMPLE----

----COMPILER OUTPUT----
test2.cpp
d:\My Documents\Visua l Studio Projects\cpptes t\test2.cpp(9) : 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
----END COMPILER OUTPUT----

The error occurs in the line marked // *. Remove the 'const' and the code
correctly fails to compile because it sees SomeClassA as a typename, but at
least in this situation it gives proper error messages, not an ICE. Remove
class SomeClassA, and the code compiles with "warning C4183: 'SomeClassA':
missing return type; assumed to be a member function returning 'int'".
Change the 'X' on line * into 'int', and the code compiles with the same
warning.

I'm not certain if code like this is supposed to compile according to the
standard with such a warning, or if it's supposed to fail like when the
const is removed, but I do know it shouldn't give an ICE.

--
Sven Groot

http://unforgiven.bloghorn.com

Nov 17 '05 #1
3 1637
Sven Groot wrote:
The bug is that the following syntax causes an Internal Compiler
Error. The code is not correct, but should produce a warning or error
message, not an ICE. It occurs when a template class mistakenly names
its constructor after a different class, and in addition uses a
template type parameter followed by 'const'. See 'example below'. The
code is complete.


I forgot to mention that this happens in Visual Studio .Net 2003.

--
Sven Groot

http://unforgiven.bloghorn.com
Nov 17 '05 #2
Sven Groot wrote:
This was posted by someone in comp.lang.c++, and later in
microsoft.publi c.vstudio.gener al, but since I know Carl is in this
group, and he's the one that should read this, I've reposted it here.
I've also minimalised the code that causes the bug.
I guess I'm the official VC++ bug reporter now ;-) (seriously though -
there's lots of people, including VC team members, that read this NG and can
handle this kind of thing just as well as I).
The bug is that the following syntax causes an Internal Compiler
Error. The code is not correct, but should produce a warning or error
message, not an ICE. It occurs when a template class mistakenly names
its constructor after a different class, and in addition uses a
template type parameter followed by 'const'. See 'example below'. The
code is complete.
I'm quite sure this is a known bug. Of course, in the ideal world, nothing
should result in an ICE. In this case, the code is ill-formed, and at least
according to the standard, an ICE is just as valid a message from the
compiler as a "proper" error message would be. Of course, to end-users, the
story is different!
I'm not certain if code like this is supposed to compile according to
the standard with such a warning, or if it's supposed to fail like
when the const is removed, but I do know it shouldn't give an ICE.


The code is ill-formed with or without the const. Note that "implicit int",
which VC supports, but which is not a part of the C++ standard, confuses
situations like this quite a bit.

-cd
Nov 17 '05 #3
Thanks Sven for reporting the issue. It could be a known issue but I logged
it as issue# 583177 anyways.

I also made sure that it is currently fixed using the most recent compiler
builds. With the current compiler bits, meaningful erros are reported.

--------------------
| From: "Sven Groot" <sv*******@gmx. net>
| Subject: [BUG] ICE cause by template class with constructor-like
declaration with name of different class and template const parameters
| Date: Thu, 6 May 2004 21:47:15 +0200
| Lines: 55
| MIME-Version: 1.0
| Content-Type: text/plain;
| format=flowed;
| charset="iso-8859-1";
| reply-type=original
| Content-Transfer-Encoding: 7bit
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2120
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2120
| Message-ID: <#4************ **@TK2MSFTNGP10 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 26-192.surfsnel.ds l.internl.net 145.99.192.26
| Path:
cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 0
.phx.gbl
| Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:36535
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc
|
| This was posted by someone in comp.lang.c++, and later in
| microsoft.publi c.vstudio.gener al, but since I know Carl is in this group,
| and he's the one that should read this, I've reposted it here. I've also
| minimalised the code that causes the bug.
|
| The bug is that the following syntax causes an Internal Compiler Error.
The
| code is not correct, but should produce a warning or error message, not
an
| ICE. It occurs when a template class mistakenly names its constructor
after
| a different class, and in addition uses a template type parameter
followed
| by 'const'. See 'example below'. The code is complete.
|
| ----CODE SAMPLE----
| class SomeClassA
| {
| };
|
| template<typena me X>
| class SomeClassB
| {
| public:
| SomeClassA(X const &n) { }; // *
| };
|
| int main()
| {
| return 0;
| }
| ----END CODE SAMPLE----
|
| ----COMPILER OUTPUT----
| test2.cpp
| d:\My Documents\Visua l Studio Projects\cpptes t\test2.cpp(9) : 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
| ----END COMPILER OUTPUT----
|
| The error occurs in the line marked // *. Remove the 'const' and the code
| correctly fails to compile because it sees SomeClassA as a typename, but
at
| least in this situation it gives proper error messages, not an ICE.
Remove
| class SomeClassA, and the code compiles with "warning C4183:
'SomeClassA':
| missing return type; assumed to be a member function returning 'int'".
| Change the 'X' on line * into 'int', and the code compiles with the same
| warning.
|
| I'm not certain if code like this is supposed to compile according to the
| standard with such a warning, or if it's supposed to fail like when the
| const is removed, but I do know it shouldn't give an ICE.
|
| --
| Sven Groot
|
| http://unforgiven.bloghorn.com
|
|
--
Ayman Shoukry, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1771
by: Luke | last post by:
Hi, I'm getting an OverflowError which doesn't make sense to me. Is this a python bug? Traceback (most recent call last): File "/home/demoau/lib/py/omniORB/__init__.py", line 717, in static_is_a for b in cls.__bases__: OverflowError: long int too large to convert to int
4
1407
by: news.microsoft.com | last post by:
BUG: struct default constructor is not displayed on intellisense yet it is available, BUG Make a struct type with a parameterized constructor. Try to construct the type in the IDE and check for the 2 overloads (Default AND the parameterizedone) the default one is NOT displayed thus
0
1123
by: gary lim | last post by:
http://groups.google.com.sg/groups?hl=en&lr=&ie=UTF-8&threadm=u2LgMaFYDHA.2020%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fnum%3D50%26hl%3Den%26lr%3D%26ie%3DUTF-8%26q%3Dasp.net%2Bbug%2Bimage%2Boninit%26btnG%3DSearch with reference to another post regarding this issue. I found a reproducible bug that cause the OnInit to run multiple time. the cause: <a href="http://www.dummy.com" ><img src="../FakeFolder/justcomz_logo.GIF" width="260"...
14
1734
by: Klaus Löffelmann | last post by:
Hi, does anybody know, why the second contructor isn't called in this example? Are you able to reproduce this bug? Thanks Klaus Public Class Something
102
7076
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality of its documentation, it is a impeccability. it has or possesses properties of:
16
1735
by: Edward Diener | last post by:
After spending more than a day reducing a complicated compiler bug to a simple case I reported it to the MSDN Product Feedback Center as a bug just now. However this bug is completely stymying my development of a VC++ component. Does Microsoft still offer any free bug reporting cases for VS2005, as they did two for VS2003 so that I can talk with a technical representative directly to try to find a workaround for the compiler bug ? While...
9
2053
by: fabio.bizzetti | last post by:
Hello all, I went across what seems possibly a bug of the compiler (VisualC 2005, just for the record) or a very strange and non-expected (by me at least) behaviour of the C++ ISO standard. Thus I'm posting on both newsgroups. Here we go: I noticed that if I nest a structure inside another one, the wrong constructor will be called.. the one from a different class!! Here is some test code:
0
271
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 428 open ( +6) / 3417 closed ( +2) / 3845 total ( +8) Bugs : 939 open ( +6) / 6229 closed (+17) / 7168 total (+23) RFE : 240 open ( +3) / 239 closed ( +0) / 479 total ( +3) New / Reopened Patches ______________________
4
1740
by: mario.rossi | last post by:
Hi all, I am trying to invoke the default constructor from another, parametrized, constructor, but the default constructor doesn't get invoked at all, I saw. Is this correct ISO C++ behaviour or my compiler has a ++bug (overflowing)? struct Test { int x; int y; // Test() {
4
342
by: mike3 | last post by:
Hi. I seem to have made some progress on finding that bug in my program. I deactivated everything in the bignum package that was used except for the returning of BigFloat objects. I even crippled all the constructors. So now all the operations and constructors that were used do is just return BigFloats but no memory is actually accessed at any point, nor is any allocated. However, when I reenable those parts of the constructor that...
0
8808
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8712
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9077
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5959
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4729
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3160
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.