This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/24530] New: throw catch clause does not accept string
- From: "alienforever at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2005 21:39:41 -0000
- Subject: [Bug libstdc++/24530] New: throw catch clause does not accept string
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
testcase: t.cpp
#include <iostream>
#include <string>
using namespace std;
void func_1( )
{
string aCvla="func1";
throw aCvla;
}
void func_2 ()
{
char aCvla[6];
strcpy (aCvla, "func2");
throw aCvla;
}
int main()
{
try {
func_1();
} catch ( string &aCA ) {
cout << aCA << endl;
}
try {
func_2();
} catch ( char * aCA ) {
cout << aCA << endl;
}
}
Invocations
g++ t.cpp
./a.out
expected output:
func1
func2
Actual output:
func1
<garbage>
--
Summary: throw catch clause does not accept string
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alienforever at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24530