xref: /llvm-project/clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp (revision 6f30ef360127ffb3346fd3d3e60a229ed44dc667)
1 // RUN: %clang -fsyntax-only -std=c++17 %s -Xclang -verify
2 
3 // The important part is that we do not crash.
4 
5 template<typename T> T declval();
6 
7 template <typename T>
Call(T x)8 auto Call(T x) -> decltype(declval<T>()(0)) {}
9 
10 class Status {};
11 
fun()12 void fun() {
13   // The Status() (instead of Status) here used to cause a crash.
14   Call([](auto x) -> Status() {}); // expected-error{{function cannot return function type 'Status ()}}
15 }
16