Article View: gnu.g++.bug
Article #1713Problems with Gnu's own examples ???
From: Tim Day
Date: Thu, 09 Mar 1989 22:19
Date: Thu, 09 Mar 1989 22:19
28 lines
1041 bytes
1041 bytes
I can't get the following to compile (or fail cleanly) under g++ version 1.32.0
(is essentially the example from ``naming an expression's type'' in the
manual).
-------
#include <stream.h>
#define max(a,b) \
({typedef _ta = (a),_tb = (b); \
_ta _a = (a);_tb _b = (b); \
_a > _b ? _a : _b; })
main()
{ int a=1,b=2;
cout << max(a,b); // Here
exit(0);
}
-------
Error is :
In function int main ():
ttest.cc:10: Segmentation violation
g++: Program c++ got fatal signal 11.
Also segmentation faults using a version based on 'typeof'.
Using
#define max(a,b) ((a)<(b)?(a):(b))
gives no problems
Technical Details
Message-ID:
<8903092200.AA05384@prep.ai.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!PURPLE.CS.UCL.AC.UK!T.DayShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!PURPLE.CS.UCL.AC.UK!T.Day From: T.Day@PURPLE.CS.UCL.AC.UK (Tim Day) Newsgroups: gnu.g++.bug Subject: Problems with Gnu's own examples ??? Message-ID: <8903092200.AA05384@prep.ai.mit.edu> Date: 9 Mar 89 22:19:23 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 28