| 1 |
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s |
| 2 |
// RUN: not %clang_cc1 -fsyntax-only -std=c++11 -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=1 %s 2>&1 | FileCheck %s -strict-whitespace |
| 3 |
|
| 4 |
auto a() -> int; // ok |
| 5 |
const auto b() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'const auto'}} |
| 6 |
auto *c() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto *'}} |
| 7 |
auto (d() -> int); // expected-error {{trailing return type may not be nested within parentheses}} |
| 8 |
auto e() -> auto (*)() -> auto (*)() -> void; // ok: same as void (*(*e())())(); |
| 9 |
|
| 10 |
namespace GH78694 { |
| 11 |
|
| 12 |
template <typename T> struct B { |
| 13 |
// CHECK: error: function with trailing return type must specify return type 'auto', not 'void' |
| 14 |
// CHECK-NEXT: {{^}} template <class U> B(U) -> B<int>; |
| 15 |
// CHECK-NEXT: {{^}} ~~~~~~~~^~~~~~{{$}} |
| 16 |
template <class U> B(U) -> B<int>; // expected-error {{function with trailing return type must specify return type 'auto', not 'void'}} |
| 17 |
}; |
| 18 |
} |