Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2004

Tip: Looking for answers? Try searching our database.

Bug Report: Incorrect treatment of function types in VC7.1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan Turkanis - 03 Mar 2004 22:43 GMT
According to 8.3.5/3 the types int(int(int)) and int(int(*)(int))
should be the same. Indeed, the test program at the end of this
message compiles and executes correctly on

   Comeau 4.3.3,
   Codewarrior 8.0 and 9.2,
   Intel 7.1 and 8.0 for Windows, and
   GCC 3.2 and 3.3.1.

On VC7.1, the static assertion fails; if it is commented out, the
program compiles and the runtime assertion succeeds.

I'm writing an implementation of several logical formalisms for use
with Boost.MPL. This and related bugs are keeping the prefered syntax
from working on VC7.1

Thanks for your help.

Jonathan

---------------------------

#include <cassert>
#include <iostream>
#include <typeinfo>

//--------------Definition of is_same-----------------------------//

template<typename T, typename U>
struct is_same { enum { value = false }; };
template<typename T>
struct is_same<T, T> { enum { value = true }; };

//--------------Definition of STATIC_ASSERT-----------------------//

template<bool B> struct STATIC_ASSERTION_FAILURE { };
template<> struct STATIC_ASSERTION_FAILURE<false>;
#define STATIC_ASSERT(x) \
   { STATIC_ASSERTION_FAILURE< x > s; (void) s; };

int main()
{
   typedef int first(int(int));
   typedef int second(int(*)(int));
   STATIC_ASSERT((is_same<first, second>::value));
   assert(typeid(first) == typeid(second));
}
David Lowndes - 04 Mar 2004 21:09 GMT
Jonathan,

I don't have an answer to your problem, but as the same problem exists
with the current Whidbey alpha compiler, I've forwarded your report to
MS.

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

Jonathan Turkanis - 04 Mar 2004 21:27 GMT
> Jonathan,
>
> I don't have an answer to your problem, but as the same problem exists
> with the current Whidbey alpha compiler, I've forwarded your report to
> MS.

Thanks.

Jonathan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.