Partager via


Summary of Compile-Time Breaking Changes 

This topic summarizes the compile-time errors and warnings that will now be issued on code that compiled without errors or warnings prior to Visual C++ 2003. However, some conformance-related, compile-time breaking changes were introduced in Visual C++ 2005.

  • Closing parentheses now required for the defined preprocessor directive (C2004).

  • Missing typename keyword and explicit specializations no longer find template parameters from primary template (C2146 ).

  • A protected member (n) can only be accessed through a member function of a class (B) that inherits from the class (A) of which it (n) is a member (C2247).

  • Improved accessibility checks in compiler now detect inaccessible base classes (C2247).

  • An explicit specialization can not be a copy constructor or copy assignment operator (C2299).

  • An exception cannot be caught if the destructor and/or copy constructor is inaccessible (C2316).

  • Default arguments on pointers to functions no longer allowed (C2383).

  • A static data member cannot be initialized via derived class (C2477).

  • The initialization of a typedef is not allowed by the standard and now generates a compiler error (C2513).

  • bool is now a proper type (C2632).

  • A UDC can now create ambiguity with overloaded operators (C2666).

  • A qualification conversion is not the same as identity conversion (C2666).

  • More expressions are now considered valid null pointer constants (C2668).

  • template<> is now required in places where the compiler would previously infer it (C2768).

  • The explicit specialization of a member function outside the class is not valid if the function has already been explicitly specialized via a template class specialization. (C2910).

  • For every explicit specialization, you must chose the parameters of the every explicit specialization, such that, they match the parameters of the primary template (C2912).

  • Floating point non-type template parameters are no longer allowed (C2993).

  • Class templates are not allowed as template type arguments (C3206).

  • Friend function names are no longer introduced into containing namespace (C3767).

  • Enhanced pointer-to-member conformance (C3867).

  • The compiler will no longer accept extra commas in a macro (C4002).

  • An object of POD type constructed with an initializer of the form () will be default-initialized (C4345).

  • typename is now required if a dependent name is to be treated as a type (C4346).

  • Functions that were incorrectly considered template specializations are no longer considered so (C4347).

  • Static data members cannot be initialized via derived class (C4356).

  • A class template specialization needs to be defined before it was used in a return type (C4686).

  • The compiler now reports unreachable code (C4702).

  • A friend declaration that declares a new non-template function must be defined (LNK2019).

See Also

Reference

Breaking Changes in the Visual C++ Compiler