🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Kim Coleman Mon, 03 Apr 1989 21:57
g++ 1.34.1 bug
#1814
Author: Kim Coleman
Date: Mon, 03 Apr 1989 21:57
41 lines
1797 bytes
//  Bug with function call parameters in g++ 1.34.1
//
//  Declaring a class method with a function call default parameter seems to
//  cause subsequent confusion when compiling the completion of the method.
//  In the program below, the compiler will hang if there are errors in the
//  body of annoying::problem. I've hung it with syntax errors, semantic
//  errors, and warnings (in particular, assignment of a constant pointer to
//  a non-constant pointer). Related error messages are not printed out.
//  Only a default parameter value that is a function call seems to provoke
//  this behavior. As long as you write perfect programs, all is well! :-)
//
//  Older revs of the compiler (pre-1.34) hung up whether or not there were
//  errors (or even statements) in the function body.
//

int foo();

class annoying
{
  public:
     void  problem( int  position = foo() );
};


void annoying::problem( int position )
{
   int i;
   i = unknown;                // will cause compiler to hang

   i=;                         // so will this

   int* p;
   const int* cp;
   p = cp;                     // and this
}

----------------------
Kim Coleman
Data General Corp., Research Triangle Park, NC
{the world}!mcnc!rti!dg-rtp!coleman
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