This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR2204] Check for parameters of abstract types (partial fix)


"Giovanni Bajo" <giovannibajo@libero.it> writes:

|         if (TREE_CODE (decl) == VAR_DECL)
| !  error ("%Jcannot declare variable `%D' to be of abstract type `%T'",
| !         decl, decl, type);

That is an abuse of %J.  Use error_at instead.  E.g.

  error_at ("cannot declare variable `%+D' to be of abstract type `%T'",
            decl, type);


| !  error ("%Jcannot declare parameter `%D' to be of abstract type `%T'",
| !         decl, decl, type);

Ditto.

|         else if (TREE_CODE (decl) == FIELD_DECL)
| !  error ("%Jcannot declare field `%D' to be of abstract type `%T'",
| !         decl, decl, type);

Ditto.

|         else if (TREE_CODE (decl) == FUNCTION_DECL
|           && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
| !  error ("%Jinvalid abstract return type for member function `%#D'",
| !         decl, decl);

Ditto.

|         else if (TREE_CODE (decl) == FUNCTION_DECL)
| !  error ("%Jinvalid abstract return type for function `%#D'",
| !         decl, decl);

Ditto.

As a side comment, I don't understand why you went through that
change.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]