🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #105

Bugs

#105
From: EWALLACE
Date: Wed, 22 Jul 1992 12:29
115 lines
3424 bytes
Some stuff for your perusal.



---------------------------------------------------------------------------
* Program(test.c):
int main(void) {}

* System:
RS/6000, AIX 3.1.5 (with assembler patch), GNU C++ 2.2.2

* Command Line:
g++ -fansi-exceptions test.c

* Output:
/tmp/ccMkgCnm.s: line 5: undefined symbol "exceptionHandlerStack"
/tmp/ccMkgCnm.s: line 5: illegal expression
/tmp/ccMkgCnm.s: line 37: undefined symbol ".longjmp"
/tmp/ccMkgCnm.s: line 37: illegal expression type for branch address
/tmp/ccMkgCnm.s: line 57: undefined symbol ".longjmp"
/tmp/ccMkgCnm.s: line 57: illegal expression type for branch address

---------------------------------------------------------------------------
* Program(testex.c):
extern "C" void puts(const char *);

class foo {
public:
  class error {};

  void cause_error(void) { throw error(); }
};

int main(void)
{
  foo f;
  try {
    f.cause_error();
  }
  catch (foo::error) {
    puts("Caught it.");
  }
  return 0;
}

* System:
RS/6000, AIX 3.1.5, GNU C++ 2.2.2

* Command Line:
g++ -fansi-exceptions testex.c

* Output:
testex.c: In method `void  foo::cause_error ()':
testex.c:9: no member function `foo::error'
testex.c:9: no member function `foo::error'
testex.c: In function `int  main ()':
testex.c:22: warning: control reaches end of non-void function

---------------------------------------------------------------------------
* This is more of a slight annoyance than a bug.

class foo {
public:
  int data;
  foo(int dat) { data = dat; }
};

class bar {
public:
  foo f[3] = { 1, 2, 3 };   // works: f[0] = 1, f[1] = 2, f[2] = 3
};

class bar2 {
public:
  foo f[3] = { foo(1), foo(2), foo(3) };
  // does not compile -- error: field initializer is not constant
};

int main(void)
{
  foo f[3] = { foo(1), foo(2), foo(3) };
  // standard C++ ... and it works too! :)
  return 0;
}

By the way, initializing members is not documented in gcc.info:extensions.
I'm assuming its presence is intentional. :)

---------------------------------------------------------------------------
* Install
  For completeness, here are the warnings I got compiling gcc 2.2.2 with
  itself on the system above.

regclass.c:
      247 |           p = &reg_class_superclasses[i][0];
            ............a...............................
a - 1506-152: (W) Operands are pointers to different types.
      251 |           p = &reg_class_subclasses[j][0];
            ............a.............................
a - 1506-152: (W) Operands are pointers to different types.

enquire.c: In function `cprop':
enquire.c:1362: warning: comparison is always 0 due to limited range of data type

cp-decl.c: In function `hack_incomplete_structures':
cp-decl.c:10584: warning: comparison is always 1 due to limited range of data type

---------------------------------------------------------------------------

Eric Wallace

Comments, questions, flames to:

ewallace@endvmtkl.vnet.ibm.com
erk@chezmoto.ai.mit.edu
Technical Details
Message-ID: <9207221230.AA08566@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!endvmtkl.vnet.ibm.COM!EWALLACE

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!endvmtkl.vnet.ibm.COM!EWALLACE
From: EWALLACE@endvmtkl.vnet.ibm.COM
Subject: Bugs
Message-ID: <9207221230.AA08566@life.ai.mit.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 22 Jul 1992 12:29:30 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 117