Promotion through assignment?
Michael Vance
briareos@lokigames.com
Thu Jun 15 09:33:00 GMT 2000
Is this non-promotion an issue with gcc (2000612) or an aggressive
promotion by MSVC (which compiles it fine)? A private Cc: is
appreciated.
#include <string>
class R
{
public:
R( void ) {
name[0] = '\0';
value[0] = '\0';
}
R( const char* n, const char* v ) {
strncpy( name, n, 64 );
strncpy( value, v, 128 );
}
operator std::string() const;
private:
char name[64];
char value[128];
};
R::operator std::string() const {
std::string s( name );
s += '/';
s += value;
return s;
}
class I
{
public:
I( const std::string& s );
private:
char id[256];
};
I::I( const std::string& s )
{
strncpy( id, s.c_str( ), 256 );
}
int main( int argc, char* argv[] )
{
R r( "name", "value" );
#if 1
I i = r;
#else
I i( r );
#endif
return 0;
}
m.
--
Programmer "Ha ha." "Ha ha." "What are you laughing at?"
Loki Software "Just the horror of being alive."
http://lokigames.com/~briareos/ - Tony Millionaire
More information about the Gcc-bugs
mailing list