$ cat t.cc void* func( bool b ) { return b ? 0 : throw 5; } $ g++ -c t.cc template.cc: In function 'void* func(bool)': template.cc:3:24: error: invalid conversion from 'int' to 'void*'
Replace 'throw 5' with '0' and it compiles as expected. -- Summary: conditional operator can't convert 0 to pointer Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: joerg dot richter at pdv-fs dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43932