File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -2707,6 +2707,17 @@ void CastOperation::CheckCStyleCast() {
2707
2707
return ;
2708
2708
}
2709
2709
2710
+ // If the type is dependent, we won't do any other semantic analysis now.
2711
+ if (Self.getASTContext ().isDependenceAllowed () &&
2712
+ (DestType->isDependentType () || SrcExpr.get ()->isTypeDependent () ||
2713
+ SrcExpr.get ()->isValueDependent ())) {
2714
+ assert ((DestType->containsErrors () || SrcExpr.get ()->containsErrors () ||
2715
+ SrcExpr.get ()->containsErrors ()) &&
2716
+ " should only occur in error-recovery path." );
2717
+ assert (Kind == CK_Dependent);
2718
+ return ;
2719
+ }
2720
+
2710
2721
// Overloads are allowed with C extensions, so we need to support them.
2711
2722
if (SrcExpr.get ()->getType () == Self.Context .OverloadTy ) {
2712
2723
DeclAccessPair DAP;
Original file line number Diff line number Diff line change @@ -81,4 +81,9 @@ void test2() {
81
81
// CHECK-NEXT: |-DeclRefExpr {{.*}} 'int *' lvalue
82
82
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'float' lvalue
83
83
(ptr > f ? ptr : f );
84
+
85
+ // CHECK: CStyleCastExpr {{.*}} 'float' contains-errors <Dependent>
86
+ // CHECK-NEXT: `-RecoveryExpr {{.*}} '<dependent type>'
87
+ // CHECK-NEXT: `-DeclRefExpr {{.*}} 'some_func'
88
+ (float )some_func ();
84
89
}
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -verify -frecovery-ast -fno-recovery-ast-type %s
2
2
3
- int call (int ); // expected-note2 {{'call' declared here}}
3
+ int call (int ); // expected-note3 {{'call' declared here}}
4
4
5
5
void test1 (int s ) {
6
6
// verify "assigning to 'int' from incompatible type '<dependent type>'" is
7
7
// not emitted.
8
8
s = call (); // expected-error {{too few arguments to function call}}
9
+
10
+ // verify diagnostic "operand of type '<dependent type>' where arithmetic or
11
+ // pointer type is required" is not emitted.
12
+ (float )call (); // expected-error {{too few arguments to function call}}
9
13
}
10
14
11
15
void test2 (int * ptr , float f ) {
You can’t perform that action at this time.
0 commit comments