delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/06/17/17:47:13

From: Ulrich DOT Lauther AT mchp DOT siemens DOT de (Ulrich Lauther)
Subject: mini program does not compile
17 Jun 1997 17:47:13 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199706171430.QAA02337.cygnus.gnu-win32@fubini.mchp.siemens.de>
Mime-Version: 1.0
Original-To: gnu-win32 AT cygnus DOT com
X-Mailer: ELM [version 2.4ME+ PL28s (25)]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

The tiny program (under Windows 95) below gives me:

(C:\GNUWIN32\B18\H-I368 .... CC1PLUS.EXE 1136) In cygwin_exept_handler


#include <stdlib.h>
#include <stdio.h>


#define alignof(TYPE) (sizeof(struct{char c; TYPE x;}) - sizeof(TYPE))

template <class T>
struct test {
  int x;
  inline void fudge() {
    int h = alignof(T);
    printf("x %d\n",h);
  }
};


int main (int argc, char** argv) {

  return 0;

}


Compilation without problems under Linux.

What is the problem? What can I do?


PS:
If I change the program as follows, the problem goes away

struct foo {
  int i;
};

struct test {
  int x;
  inline void fudge() {
    int h = alignof(foo);
    printf("x %d\n",h);
  }
};


-- 
	-lauther

----------------------------------------------------------------------------
Ulrich Lauther          ph: +49 89 636 48834 fx: ... 636 42284
Siemens ZT AN 1         Internet: Ulrich DOT Lauther AT mchp DOT siemens DOT de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019