[orbitcpp-list] bug: const not static
Status: Beta
Brought to you by:
philipd
From: Artem Gr <ar...@bi...> - 2001-09-01 11:36:54
|
For 8<--------------------------------------------------------------------->8 interface Checker { struct Property { ... } typedef sequence<Property> Properties; ... } 8<--------------------------------------------------------------------->8 orbitcpp 0.30.1 generates following const definitions in class Checker: 8<--------------------------------------------------------------------->8 const CORBA::TypeCode_ptr _tc_Property = (CORBA::TypeCode_ptr)&::_orbitcpp::c::TC_Checker_Property_struct; static const CORBA::TypeCode_ptr _tc_Properties = (CORBA::TypeCode_ptr)&::_orbitcpp::c::TC_Checker_Properties_struct; 8<--------------------------------------------------------------------->8 As we can see, orbitcpp generate "static const" for "Properties", but only "const" for "Propery". But all initialized class member must be declared "static" in C++, therefore gcc complains (and exits with error): 8<--------------------------------------------------------------------->8 In file included from Checker-cpp-stubs.hh:11, from Checker-cpp-common.cc:6: Checker-cpp-common.hh:55: ANSI C++ forbids initialization of member `_tc_Property' Checker-cpp-common.hh:55: making `_tc_Property' static 8<--------------------------------------------------------------------->8 P.S. All is working fine when we manually replace generated "const" with "static const". I currently use following perl program (between corba-idl and g++) as temporary solution: 8<--------------------------------------------------------------------->8 #!/usr/bin/perl my $file = shift @ARGV; die "usage patch.pl FILE" if ! -r $file; open( 'fh', "< $file" ) or die "Can't open $file: $!"; my $body = join( '', <fh> ); close( 'fh' ); my $rw = "\tstatic const CORBA::TypeCode_ptr"; $body =~ s/\tconst CORBA::TypeCode_ptr/$rw/ig; open( 'fh', "> $file" ) or die "Can't open > $file: $!"; print {'fh'} $body; close( 'fh' ) or die "Can't close $file: $!"; 8<--------------------------------------------------------------------->8 |