Thread View: gnu.g++.bug
2 messages
2 total messages
Started by Tim Day
Thu, 09 Mar 1989 22:19
Problems with Gnu's own examples ???
Author: 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
Re: Problems with Gnu's own examples ???
Author: Doug Schmidt
Date: Fri, 10 Mar 1989 03:46
Date: Fri, 10 Mar 1989 03:46
28 lines
1465 bytes
1465 bytes
In article <8903092200.AA05384@prep.ai.mit.edu> T.Day@PURPLE.CS.UCL.AC.UK (Tim Day) writes:
++ 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);
++ }
This bug should be fixed with 1.34. It resulted from a typo in
cplus-parse.y.
Doug
--
schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads