Corbettknowles issue #199325#199484
Conversation
removed ReadProfileV0 from the header it was a unused function and had deprecated i verified that wasnt being called in the corresponding .cpp the ReadprofileV1 is the only being used
line 73 had getFileLoc(loc) not recommended for template types it wrong instentation it follows the template chain back to wrong location i replaced it with getExpansionLoc(Loc) which is the correct instentation and fixes the broken explicit and implicit
added fix to line 843 after DTU flush before the debug i added formLCSSARescursively(*FC0.L, DT, &LI, &SE); which fix the chain and preserves the the LCSSA
fixes issue 99418
the file used a hard_cast for getiteratorvariable() and it was causing a SIGILL because was no null check i changed it to dyn_cast and added a null guard to return false edited on line 3766
fixes issue 199419
[Clang] Fix constrained friend function template ADL regression (GH#199325) When evaluating constraints on a friend function template during ADL, HandleFunction was using getLexicalDeclContext() to walk up to the enclosing class. This causes incorrect behavior when multiple instantiations of the enclosing class participate in the same ADL call — all candidates collapse to the same shared lexical context, causing the constraint to be evaluated against the wrong instantiation. The fix separates the ForConstraintInstantiation path from the normal instantiation path. When ForConstraintInstantiation is true, we use UseNextDecl instead of ChangeDecl(getLexicalDeclContext()), allowing the instantiation chain to be walked correctly per-candidate. This is a regression introduced in Clang 22 — Clang 21 and GCC 14/15 both accept the reproducer correctly.
|
Hello @corbettknowles 👋 Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.
Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description. Frequently asked questionsHow do I add reviewers? This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically. You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using What if there are no comments? If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers. Are any special GitHub settings required to contribute to LLVM? We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details. If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse. Thank you, |
[Clang] Fix constrained friend function template ADL regression (GH#199325)
When evaluating constraints on a friend function template during ADL,
HandleFunction was using getLexicalDeclContext() to walk up to the
enclosing class. This causes incorrect behavior when multiple
instantiations of the enclosing class participate in the same ADL
call — all candidates collapse to the same shared lexical context,
causing the constraint to be evaluated against the wrong instantiation.
The fix separates the ForConstraintInstantiation path from the normal
instantiation path. When ForConstraintInstantiation is true, we use
UseNextDecl instead of ChangeDecl(getLexicalDeclContext()), allowing
the instantiation chain to be walked correctly per-candidate.
This is a regression introduced in Clang 22 — Clang 21 and GCC 14/15
both accept the reproducer correctly.