Skip to content

Check more places that can instantiate bad templates.#1462

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_949380022
Open

Check more places that can instantiate bad templates.#1462
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_949380022

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 17, 2026

Copy link
Copy Markdown

Check more places that can instantiate bad templates.

This CL makes us more robust at detecting bad template instantiations.
(Recall that Clang won't tell us directly if trying to instantiate a
template will fail, and even when it does, it will only do so once--
but it leaves behind evidence in the AST that we have to search out.)

  • Generalize ForceDefineImplicitFunction and GetInvalidCallTarget.
    • ForceDefineImplicitFunction should also work on defaulted decls.
    • Extract EnsureFunctionDefined, CheckAndRecurse from GetInvalidCallTarget.
    • Check the entire decl in GetInvalidCallTarget instead of just the body (this was missing e.g. initializer expressions in the base case)
  • Make sure that special member functions get checked (these can be implicit.)

This CL makes us more robust at detecting bad template instantiations.
(Recall that Clang won't tell us directly if trying to instantiate a
template will fail, and even when it does, it will only do so once--
but it leaves behind evidence in the AST that we have to search out.)

  * Generalize ForceDefineImplicitFunction and GetInvalidCallTarget.
    * ForceDefineImplicitFunction should also work on defaulted decls.
    * Extract EnsureFunctionDefined, CheckAndRecurse from GetInvalidCallTarget.
    * Check the entire decl in GetInvalidCallTarget instead of just the body (this was missing e.g. initializer expressions in the base case)
  * Make sure that special member functions get checked (these can be implicit.)

PiperOrigin-RevId: 949380022
@copybara-service copybara-service Bot changed the title WIP template fix Check more places that can instantiate bad templates. Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant