16 lines · cpp
1// RUN: %clang -fsyntax-only -std=c++17 %s -Xclang -verify2 3// The important part is that we do not crash.4 5template<typename T> T declval();6 7template <typename T>8auto Call(T x) -> decltype(declval<T>()(0)) {}9 10class Status {};11 12void 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