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

  • Thread starter Thread starter Jonathan Turkanis
  • Start date 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));
}
 
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
 
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
 
Back
Top