| 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 %s |
| 2 |
|
| 3 |
// CHECK: FunctionDecl {{.*}} s1 'auto ()' |
| 4 |
auto s1(); // valid |
| 5 |
// FIXME: why we're finding int as the return type. int is used as a fallback type? |
| 6 |
// CHECK: FunctionDecl {{.*}} invalid s2 'auto () -> int' |
| 7 |
auto s2() -> undef(); |
| 8 |
// CHECK: FunctionDecl {{.*}} invalid s3 'auto () -> int' |
| 9 |
auto s3() -> decltype(undef()); |
| 10 |
// CHECK: FunctionDecl {{.*}} invalid s4 'auto ()' |
| 11 |
auto s4() { |
| 12 |
return undef(); |
| 13 |
} |
| 14 |
// CHECK: FunctionDecl {{.*}} s5 'void ()' |
| 15 |
auto s5() {} // valid, no return stmt, fallback to void |
| 16 |
|
| 17 |
class Foo { |
| 18 |
// CHECK: CXXMethodDecl {{.*}} foo1 'auto ()' |
| 19 |
auto foo1(); // valid |
| 20 |
// 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 |
}; |