brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · b77d533 Raw
29 lines · cpp
1// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -frecovery-ast -std=gnu++17 -ast-dump %s | FileCheck -strict-whitespace %s2 3// CHECK: FunctionDecl {{.*}} s1 'auto ()'4auto s1(); // valid5// FIXME: why we're finding int as the return type. int is used as a fallback type?6// CHECK: FunctionDecl {{.*}} invalid s2 'auto () -> int'7auto s2() -> undef();8// CHECK: FunctionDecl {{.*}} invalid s3 'auto () -> int'9auto s3() -> decltype(undef());10// CHECK: FunctionDecl {{.*}} invalid s4 'auto ()'11auto s4() {12  return undef();13}14// CHECK: FunctionDecl {{.*}} s5 'void ()'15auto s5() {} // valid, no return stmt, fallback to void16 17class Foo {18  // CHECK: CXXMethodDecl {{.*}} foo1 'auto ()'19  auto foo1(); // valid20  // CHECK: CXXMethodDecl {{.*}} invalid foo2 'auto () -> int'21  auto foo2() -> undef();22  // CHECK: CXXMethodDecl {{.*}} invalid foo3 'auto () -> int'23  auto foo3() -> decltype(undef());24  // CHECK: CXXMethodDecl {{.*}} invalid foo4 'auto ()'25  auto foo4() { return undef(); }26  // CHECK: CXXMethodDecl {{.*}} foo5 'void ()'27  auto foo5() {} // valid, no return stmt, fallback to void.28};29