llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Akash Manna (akash-manna-sky)

<details>
<summary>Changes</summary>

Fixes #<!-- -->204059

When a function template's return type contains a member access whose 
nested-name-specifier starts with a template type parameter, e.g. 
`decltype(t.U::template B&lt;&gt;::MEM)`, the parser records `U` as the first 
qualifier found in scope. During substitution, `TransformFirstQualifierInScope` 
fetched `U`'s template argument without checking that one exists. Two callers 
legitimately substitute with an incomplete list: explicit template argument 
substitution before deduction (`k&lt;S&gt;(S{})`), and partial deduction for 
code completion signature help (`k(`). The first hit an out-of-bounds index, 
the second a null argument, and both tripped an assertion.

Every other parameter handler in the instantiator checks `hasTemplateArgument` 
first and records the substitution as incomplete. This does the same here, 
leaving the qualifier dependent so the expression is rebuilt as a dependent 
member access. Signature help then shows the candidate with `U` unresolved, and 
the explicit call correctly reports that `U` could not be inferred.


---
Full diff: https://github.com/llvm/llvm-project/pull/225088.diff


4 Files Affected:

- (modified) clang/docs/ReleaseNotes.md (+6) 
- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+5) 
- (added) clang/test/CodeCompletion/GH204059.cpp (+10) 
- (modified) clang/test/SemaTemplate/dependent-names.cpp (+9) 


``````````diff
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

``````````

</details>


https://github.com/llvm/llvm-project/pull/225088
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to