File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5726,7 +5726,10 @@ class ConceptInfo {
5726
5726
QualType getApproximateType (const Expr *E, HeuristicResolver &Resolver) {
5727
5727
if (E->getType ().isNull ())
5728
5728
return QualType ();
5729
- E = E->IgnoreParenImpCasts ();
5729
+ // Don't drop implicit cast if it's an array decay.
5730
+ if (auto *ICE = dyn_cast<ImplicitCastExpr>(E);
5731
+ !ICE || ICE->getCastKind () != CK_ArrayToPointerDecay)
5732
+ E = E->IgnoreParenImpCasts ();
5730
5733
QualType Unresolved = E->getType ();
5731
5734
// Resolve DependentNameType
5732
5735
if (const auto *DNT = Unresolved->getAs <DependentNameType>()) {
Original file line number Diff line number Diff line change @@ -36,3 +36,12 @@ void test4(struct Point *p) {
36
36
}
37
37
// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-3):13 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
38
38
// RUN: %clang_cc1 -fsyntax-only -code-completion-with-fixits -code-completion-at=%s:%(line-3):23 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
39
+
40
+ float test5 (void ) {
41
+ struct Point array [4 ];
42
+ return array -> x ;
43
+ }
44
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):17 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
45
+ // CHECK-CC4: COMPLETION: x : [#float#]x
46
+ // CHECK-CC4: COMPLETION: y : [#float#]y
47
+ // CHECK-CC4: COMPLETION: z : [#float#]z
You can’t perform that action at this time.
0 commit comments