473,657 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\BLI nstallation\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\BLI nstallation\tst \tst.cpp(14) : see declaration of
'ReturnTypeCast '
c:\Projects\BLI nstallation\tst \tst.cpp(20) : see declaration of
'ReturnTypeCast '
c:\Projects\BLI nstallation\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 1483
>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
5428
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 do not compile with "Allow Unsafe Code Blocks=false" set to true, then the project compiles and no problems. BUT if I compile with "Allow Unsafe Code Blocks=true" then I het the error below. With unsafe {} of unsave{} removed it dos not solve the...
1
4057
by: Irakli Lomidze | last post by:
Internal Compiler Error VS.NET 2003 Enterprise Architect Windowx XP SP1 RAM 1GB Free DiskSpacs 20GB
1
2001
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 Trait<int>::result foo<int>(); // Line causes errors Shouldn't this code compile correctly? If so, is Microsoft aware of this bug Bill Rubin
1
6669
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 specialization of a function template For this code: template< class T > inline bool Equal( const typename T::type v0, const typename T::type v1 )
2
5731
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 in debug mode, the following errors happened: d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29): error C2365: 'new' : redefinition; previous definition was a 'member function' d:\Program Files\Microsoft Visual Studio...
3
1599
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 Studio,NET 2003" during the installation. Do I have to do the migration of the "Settings" if I want to use the both versions of VC++.NET in the Side-by-Side fashion? 2) I ran the "Build" of the example 'Chapter5_Example1' of 'Beginning DirectX 9' by...
11
2200
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 make: File, New, Project, Visual Basic Projects, Class Library, name of project: ComponentVB. We write the code: Public Function myFunction1(ByVal N_i As Integer, _
9
4647
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 std::list<CComPtr<ITypeLib> >. I understand the problem, so am looking for the correct solution to my problem. On the line that attempts to call push_back, I receive "error C2664: 'std::allocator<_Ty>::construct' : cannot convert parameter 1...
2
2226
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 project is not Building using VC++Express2005. The error is as follows: 1>Compiling... 1>StdAfx.cpp 1>\stdafx.h(35) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory
0
8420
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...
1
8516
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,...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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.