This is the mail archive of the 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]

[C++ PATCH] [PR17447] Check incomplete types of parameters in templates


currently, within templates, we do not check if the parameters of functions
have incomplete type or not. I think this is a leftover of when we were
postponing all the semantic checks at instantiation time. The fix is
straightforward. Using dependent_type_p didn't work out, probably because of
when it was invoked outside the templates. Actually I did not bother
investigating further because uses_template_parms did the trick for me (and
it's equivalent to dependent_type_p when called with a TYPE_P, but always set
processing_template_decl to 1).

Tested on i686-pc-linux-gnu with no new regressions. OK for mainline?

Giovanni Bajo

        * decl.c (start_preparsed_function): Call check_function_type even
        in templates.
        (require_complete_types_for_parms): Skip dependent types.
        (check_function_type): Likewise.

        * g++.dg/template/incomplete1.C: New test.

Attachment: patch-pr17447.txt
Description: Text document

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