autoconf error with MS VC++ 2015

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

autoconf error with MS VC++ 2015

Jan Rheinländer
Hi,

I'm configuring with autoconf (Ubuntu 16.04 standard package: Version:
2.69-9) using

Microsoft (R) C/C++-Optimierungscompiler Version 19.00.24215.1 für x86

The following test gives an infinite loop because compilation of
contest.cpp always fails:

---
configure: checking for integer types and behaviour...
creating
---

The conftest.cpp in question contains

---
#ifdef __cplusplus
# ifdef __GNUC__
#  define alignof(type)  __alignof__ (type)
# else
   template <class type> struct alignof_helper { char slot1; type slot2; };
#  define alignof(type)  offsetof (alignof_helper<type>, slot2)
# endif
#else
# define alignof(type)  offsetof (struct { char slot1; type slot2; }, slot2)
#endif

int
main ()
{
typedef int verify[2*(alignof(char) == 76) - 1];
  ;
  return 0;
}
---

The compiler gives the following error messages (I translated them from
German):

---
conftest.cpp(45): error C2275: "alignof_helper<char>": illegal use of
this type as an expression
conftest.cpp(45): note: See declaration of "alignof_helper<char>"
conftest.cpp(45): error C2065: "slot2": undeclared identifier
conftest.cpp(45): error C3861: "offsetof": identifier was not found
---

What does work is:

---
#include <stddef.h>

struct alignof_helper { char slot1; char slot2; };

int
main ()
{
  typedef int verify[2*(offsetof(struct alignof_helper, slot2) == 1) - 1];
  ;
  return 0;
}
---

and the program compiles fine when the test is == 1 and fails with error
C2118: "negative index" when it is == 2.

Greetings,
    Jan


Loading...