Test with MSVC 8 C4180 warning const cannot be applied to a typedef

Test at 13 Jan 2006 MS moans in basic_cstring.hpp at value_type operator[]( size_type index ) const; value_type at( size_type index ) const; "C4180 qualifier applied to function type has no meaning; ignored" A qualifier, such as const, is applied to a function type defined by typedef. Example Copy Code// C4180.cpp // compile with: /W1 /c typedef int *FuncType(void); // the const qualifier cannot be applied to the function type FuncType const FuncType f; // C4180 Does this mean it wants a typedef const_value_type instead? Meanwhile, I have added to suppress_warnings.hpp # pragma warning(disable: 4224) // nonstandard extension used : formal parameter 'tm' was previously defined as a type tm needs renaming? # pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored Suppresses the clutter. (And I feel strongly that although trivial, Boost should try hard to avoid spurious warnings like these for those whose Standards demand they use the pickiest warning level). (Speaking boost-wide, I note that warning C4127: conditional expression is constant is very common and I cannot conceive of when it could possibly be helpful. Also warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) Should a 'certain to be included' boost file 'globally' disable at least these two warnings? Insert into boost config? ) Paul PS MSVC 8.0 notes: Conversion wizard runs fine with no errors. (some 3 conversion warnings which look unimportant). There are very many warnings like: i:\boost-06-01-13-0500\boost\test\results_collector.hpp(79) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'boost::unit_test::singleton<Derived>' with [ Derived=boost::unit_test::results_collector_t ] i:\boost-06-01-13-0500\boost\noncopyable.hpp(22) : see declaration of 'boost::noncopyable_::noncopyable' Should this be disabled somewhere too? -- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB Phone and SMS text +44 1539 561830, Mobile and SMS text +44 7714 330204 mailto: pbristow@hetp.u-net.com http://www.hetp.u-net.com/index.html http://www.hetp.u-net.com/Paul%20A%20Bristow%20info.html

Test at 13 Jan 2006 MS moans in basic_cstring.hpp at
value_type operator[]( size_type index ) const; value_type at( size_type index ) const;
"C4180 qualifier applied to function type has no meaning; ignored"
I know about this. And it doen't make any sence to me. Looks like clear compiler bug.
Meanwhile, I have added to suppress_warnings.hpp
# pragma warning(disable: 4224) // nonstandard extension used : formal parameter 'tm' was previously defined as a type
tm needs renaming?
Renamed.
# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
Added to supporess/enable headers
i:\boost-06-01-13-0500\boost\test\results_collector.hpp(79) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'boost::unit_test::singleton<Derived>' with [ Derived=boost::unit_test::results_collector_t ] i:\boost-06-01-13-0500\boost\noncopyable.hpp(22) : see declaration of 'boost::noncopyable_::noncopyable'
Should this be disabled somewhere too?
This is known MS compiler issue. I do not want this to be desabled. It's actually useful warning in general.

"Gennadiy Rozental" wrote
Test at 13 Jan 2006 MS moans in basic_cstring.hpp at
value_type operator[]( size_type index ) const; value_type at( size_type index ) const;
"C4180 qualifier applied to function type has no meaning; ignored"
I know about this. And it doen't make any sence to me. Looks like clear compiler bug.
FWIW I fixed this locally by changing the signature to : typename boost::remove_const< value_type
::type operator[]( size_t index ) const; typename boost::remove_const< value_type >::type at( size_t index ) const;
regards Andy Little

Hi Paul, I think sorting out thse warnings from Bost.Test is a great idea. Spurious warnings wastes a lot of time scrolling past them. regards Andy Little
participants (3)
-
Andy Little
-
Gennadiy Rozental
-
Paul A Bristow