Go to the first, previous, next, last section, table of contents.

GNU C++ Conformance to ANSI C++

These changes in the GNU C++ compiler were made to comply more closely with the ANSI base document, The Annotated C++ Reference Manual (the ARM). Further reducing the divergences from ANSI C++ is a continued goal of the GNU C++ Renovation Project.

Section 3.4, Start and Termination. It is now invalid to take the address of the function `main()'.

Section 4.8, Pointers to Members. The compiler produces an error for trying to convert between a pointer to a member and the type `void *'.

Section 5.2.5, Increment and Decrement. It is an error to use the increment and decrement operators on an enumerated type.

Section 5.3.2, Sizeof. Doing sizeof on a function is now an error.

Section 5.3.4, Delete. The syntax of a cast-expression is now more strictly controlled.

Section 7.1.1, Storage Class Specifiers. Using the static and extern specifiers can now only be applied to names of objects, functions, and anonymous unions.

Section 7.1.1, Storage Class Specifiers. The compiler no longer complains about taking the address of a variable which has been declared to have register storage.

Section 7.1.2, Function Specifiers. The compiler produces an error when the inline or virtual specifiers are used on anything other than a function.

Section 8.3, Function Definitions. It is now an error to shadow a parameter name with a local variable; in the past, the compiler only gave a warning in such a situation.

Section 8.4.1, Aggregates. The rules concerning declaration of an aggregate are now all checked in the GNU C++ compiler; they include having no private or protected members and no base classes.

Section 8.4.3, References. Declaring an array of references is now forbidden. Initializing a reference with an initializer list is also considered an error.

Section 9.5, Unions. Global anonymous unions must be declared static.

Section 11.4, Friends. Declaring a member to be a friend of a type that has not yet been defined is an error.

Section 12.1, Constructors. The compiler generates a default copy constructor for a class if no constructor has been declared.

Section 12.6.2, Special Member Functions. When using a mem-initializer list, the compiler will now initialize class members in declaration order, not in the order in which you specify them. Also, the compiler enforces the rule that non-static const and reference members must be initialized with a mem-initializer list when their class does not have a constructor.

Section 12.8, Copying Class Objects. The compiler generates default copy constructors correctly, and supplies default assignment operators compatible with user-defined ones.

Section 13.4, Overloaded Operators. An overloaded operator may no longer have default arguments.

Section 13.4.4, Function Call. An overloaded `operator ()' must be a non-static member function.

Section 13.4.5, Subscripting. An overloaded `operator []' must be a non-static member function.

Section 13.4.6, Class Member Access. An overloaded `operator ->' must be a non-static member function.

Section 13.4.7, Increment and Decrement. The compiler will now make sure a postfix `operator ++' or `operator --' has an int as its second argument.

Go to the first, previous, next, last section, table of contents.