brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 881742d Raw
19 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s2// 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-whitespace3 4auto a() -> int; // ok5const auto b() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'const auto'}}6auto *c() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto *'}}7auto (d() -> int); // expected-error {{trailing return type may not be nested within parentheses}}8auto e() -> auto (*)() -> auto (*)() -> void; // ok: same as void (*(*e())())();9 10namespace GH78694 {11 12template <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}19