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

  • Thread starter Jonathan Turkanis
  • Start date
J

Jonathan Turkanis

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));
}
 
D

David Lowndes

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
 
J

Jonathan Turkanis

David Lowndes said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top