[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / pr47676.cpp
blob536cea785c82327426393fcefceee3f16d431d34
1 // RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu \
2 // RUN: -target-feature +altivec -ast-dump \
3 // RUN: -xc++ < %s \
4 // RUN: | FileCheck %s
6 // Ensures that casts to AltiVec type with a dependent expression operand does
7 // not hit the assertion failure reported in PR47676. Further checks that casts
8 // to AltiVec type with a dependent expression operand is, on instantiation,
9 // able to correctly differentiate between a splat case and a bitcast case.
10 template <typename T> void f(T *tp) {
11 extern void g(int, ...);
12 g(0, (__vector int)(*tp));
13 g(0, (__vector int)*tp);
16 void g(void) {
17 f<__vector float>(nullptr);
18 // CHECK: | |-FunctionDecl {{.*}} f 'void (__vector float *)'
20 // CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' <NoOp>
21 // CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '__vector int' <BitCast>
22 // CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'__vector float' <LValueToRValue>
24 // CHECK: | `-CStyleCastExpr {{.*}} '__vector int' <NoOp>
25 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__vector int' <BitCast>
26 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'__vector float' <LValueToRValue>
28 f<double>(nullptr);
29 // CHECK: | `-FunctionDecl {{.*}} f 'void (double *)'
31 // CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' <VectorSplat>
32 // CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} 'int' <FloatingToIntegral>
33 // CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'double' <LValueToRValue>
35 // CHECK: | `-CStyleCastExpr {{.*}} '__vector int' <VectorSplat>
36 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'int' <FloatingToIntegral>
37 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'double' <LValueToRValue>