Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!pabuhr From: pabuhr@water.UUCP Newsgroups: comp.lang.c++ Subject: BUG Message-ID: <1131@water.waterloo.edu> Date: Mon, 28-Sep-87 22:05:29 EDT Article-I.D.: water.1131 Posted: Mon Sep 28 22:05:29 1987 Date-Received: Tue, 29-Sep-87 04:47:16 EDT Reply-To: pabuhr@water.UUCP () Distribution: world Organization: U. of Waterloo, Ontario Lines: 61 /* It took me 4 hours to locate this problem in a large program. If you look at the C++ code generated for the inline procedure `identity', you will notice that it has been optimized into the same single constant! I need a drink. */ class test { public: inline int identity(test *); }; inline int test::identity(test *h) { if (this != h) { return(0); } else { return(1); } }; main() { test a, b; a.identity(&a); a.identity(&b); } ================================= C++ output cd /u/pabuhr/sm/string/ ccc -F test.cc #line 1 "test.cc" /* <> */ /* < test.cc */ char *_new(); char _delete(); char *_vec_new(); char _vec_delete(); #line 1 "test.cc" #line 8 "test.cc" struct test { /* sizeof test == 1 */ char _dummy; }; #line 13 "test.cc" #line 21 "test.cc" int main (){ _main(); { #line 22 "test.cc" struct test _au1_a ; #line 22 "test.cc" struct test _au1_b ; #line 24 "test.cc" ( (1 )) ; <=== where's the beef ??? ( (1 )) ; <=== where's the beef ??? } }; /* the end */ Compilation finished at Mon Sep 28 21:53:05