1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11 2 3 struct S { 4 virtual ~S(); 5 6 void g() throw (auto(*)()->int); 7 8 // Note, this is not permitted: conversion-declarator cannot have a trailing return type. 9 // FIXME: don't issue the second diagnostic for this. 10 operator auto(*)()->int(); // expected-error{{'auto' not allowed here}} expected-error {{C++ requires a type specifier}} 11 }; 12 13 typedef auto Fun(int a) -> decltype(a + a); 14 typedef auto (*PFun)(int a) -> decltype(a + a); 15 16 void g(auto (*f)() -> int) { 17 try { } 18 catch (auto (&f)() -> int) { } 19 catch (auto (*const f[10])() -> int) { } 20 } 21 22 namespace std { 23 class type_info; 24 } 25 26 template<typename T> struct U {}; 27 28 void j() { 29 (void)typeid(auto(*)()->void); 30 (void)sizeof(auto(*)()->void); 31 (void)__alignof(auto(*)()->void); 32 33 U<auto(*)()->void> v; 34 35 int n; 36 (void)static_cast<auto(*)()->void>(&j); 37 auto p = reinterpret_cast<auto(*)()->int>(&j); 38 (void)const_cast<auto(**)()->int>(&p); 39 (void)(auto(*)()->void)(&j); 40 } 41 42 template <auto (*f)() -> void = &j> class C { }; 43 struct F : auto(*)()->int {}; // expected-error{{expected class name}} 44 template<typename T = auto(*)()->int> struct G { }; 45 46 int g(); 47 auto (*h)() -> auto = &g; // expected-error{{'auto' not allowed in function return type}} 48 auto (*i)() = &g; // ok; auto deduced as int. 49 auto (*k)() -> int = i; // ok; no deduction. 50