473,396 Members | 1,832 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,396 software developers and data experts.

C2785 and C2912 error 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 1471
>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


FWIW, your code example compiles fine with the VS2005 Beta 1 compiler.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2

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

Similar topics

8
by: | last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems with the 2003 version, hoping this solves the problems, but now I encounter this wierd bug??? If I have the project, and...
1
by: Irakli Lomidze | last post by:
Internal Compiler Error VS.NET 2003 Enterprise Architect Windowx XP SP1 RAM 1GB Free DiskSpacs 20GB
1
by: Bill Rubin | last post by:
The following code gives VC++ 7.1 compiler errors C2785 and C2912 template<class U> struct Trait {typedef double result;} template<class T> typename Trait<T>::result foo() template<> typename...
1
by: JohnPantango | last post by:
Can anyone give me a simple work around to fix this compiler error on VC7.1 .....cpp(23) : error C2912: explicit specialization; 'bool Equal<_F32>(const _F32::type,const _F32::type)' is not a...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
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...
11
by: Dr. Zharkov | last post by:
We want to export myArrayVB (2000, 2) of VB .NET 2003 in myArrayVó of VC++ .NET 2003 on scheme "component - client". But there is an error. For development of a component in VB .NET 2003 we...
9
by: Stuart Carnie | last post by:
Due to the tightening of the VC++ compiler in 2005, I have run into a compiler error (from code that previously worked in 2003) using a CComPtr<ITypeLib> as an element of a std::list, as follows...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.