473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

bug in 2003.net VC++ ??

Hi,

I'm trying to compile the following code with VC++ 2003.net. ( The real code
is a bit different, but I made a small example that does not make sense, but
it shows the problem )
The code compiles ok with the gnu 3.2.3 compiler and seems to be standard
c++ to me.
Apparently there's a bug in VC++, I'm just checking to see if there is
anybody who knows a workaround
Thanks ...

This is the code and the compilation output:

#include "stdafx.h"

template <int I>
struct ReturnType {
};
template<> struct ReturnType<0> { typedef unsigned int Result; };
template<> struct ReturnType<1> { typedef unsigned int Result; };

template <unsigned int I>
inline typename ReturnType<I>::Result ReturnTypeCast(const unsigned int& val)
{
return val;
}

template <>
inline unsigned int ReturnTypeCast<1>(const unsigned int& val)
{
return val;
}

int main()
{
return 0;
}

c:\Projects\BLInstallation\tst\tst.cpp(23) : error C2785:
'ReturnType<I>::Result ReturnTypeCast(const unsigned int &)' and 'unsigned
int ReturnTypeCast(const unsigned int &)' have different return types
c:\Projects\BLInstallation\tst\tst.cpp(14) : see declaration of
'ReturnTypeCast'
c:\Projects\BLInstallation\tst\tst.cpp(20) : see declaration of
'ReturnTypeCast'
c:\Projects\BLInstallation\tst\tst.cpp(23) : error C2912: explicit
specialization; 'unsigned int ReturnTypeCast<1>(const unsigned int &)' is not
a specialization of a function template
Nov 17 '05 #1
1 882
On Wed, 17 Nov 2004 07:22:06 -0800, keppensde
<ke*******@discussions.microsoft.com> wrote:

Tried it with Comeau too and it compiles so looks like a bug

It does compile in VC 2005 Beta though

Vin
Nov 17 '05 #2

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

Similar topics

1
by: Edward Diener | last post by:
If you run this simple console program after building it on VC++ .NET 2003, you will see the error message, "Error getting initial stream position", from the attempt to use the...
3
by: Ryan | last post by:
My project uses the /ORDER specifier to order functions as specified in file containing the decorated names of packaged functions (COMDATs). I am in the process of upgrading from VC6 to VC.NET 2003....
1
by: Matt S | last post by:
Does the liscense for the VC++.Net 2003 allow the user to purchase a downgrade to VC++.NET 2002? DO I need to buy a standard version of VC++.NET to downgrade? I need to get VC++ 2002, but I can't...
1
by: Aaron | last post by:
After taking 2 semesters of C++ at school, I've decided to get a compiler for my personal use when not at school, and one that can do Windows programming. I've pretty much come down to either vc++...
4
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an...
5
by: Michael | last post by:
i experience slower compile times with VC++ 2003 compared to VC+6.0. Anyone experiencing the same? Should that be expected? This ineed matters, when total compilation time is > 1h and you have to...
3
by: SHC | last post by:
Hi all, 1) I have used VC++.NET 2002 (v7.0) for a while. Recently I just installed VC++.NET 2003 (v7.1) - I saw the message "Settings were not migrated from Visual Studio.NET 2002 to Visual...
6
by: Felix I. Wyss | last post by:
It appears that VC++2003 has a code generator bug related to template parameters that are a pointer-to-member type: If the actual template argument is a virtual method, VC generates code that...
14
by: Jeffrey Baker | last post by:
Hello, I wrote a program way back when VC++ 5.0 was around and when using this program in VC++ 2003 I get garbage. I was able to let the program run through code that would view the data. Since...
2
by: pmbcan | last post by:
I have a project written in VC++ 2003.NET which uses MFC classes. I have ONLY VC++Express2005. I can open the VCProject file sucessfully. The conversion takes place without any error. BUT the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.