Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!columbia!read.columbia.edu!kearns2 From: kearns2@read.columbia.edu (Steve Kearns) Newsgroups: comp.lang.c++ Subject: default argument bug in 1.2! Message-ID: <6409@columbia.edu> Date: 23 Jul 89 18:02:58 GMT References: <503@gill.UUCP> Sender: news@columbia.edu Reply-To: kearns@read.UUCP (Steve Kearns) Organization: Columbia University Department of Computer Science Lines: 25 Is there a workaround for the following bug? When I declare a member function to have a default constant argument, such as : class bar { foo(int joe, int bill = -1); }; Then the definition of foo usually contains a test like the following: if (bill == -1) { ...do this...} else { ...do that...} The bug is that 1.2 seems to optimize out the if (bill == ..) test and include, in this case, only the first branch of the "if". It seems to treat the "int bill = -1" declaration as if I was initializing a local variable. Does anyone know any workarounds? -steve