This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Throwing constant objects (Snapshot 981026-latest rpm)


Hi,

the following code does not compile with the mentioned version (981026) as
"throw" does not want to take constant objects. Can anyone verify this with a
more current snapshot? Or am i wrong and doing bad things?

--- throw_constant.cpp
#define ANY int // a class with a public constructor

void athrow(const ANY & e) throw(ANY)
{
   throw e;
}

int main(void)
{
   athrow(ANY());
   return 0;
}
---
And the Compiler (g++ throw_constant.cpp -o throw_constant) says:

throwconst.cpp: In function oid athrow(const int &)':
throwconst.cpp:5: passing onst int *' as argument 1 of _cp_push_exception(void *, void *, void (*)(void *, int))' discards qualifiers

(OS is Linux on Ix86)

Bye, Sebastian Ritterbusch.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]