1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11
6 void g() throw (auto(*)()->int);
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 in conversion function type}} expected-error {{C++ requires a type specifier}}
13 typedef auto Fun(int a) -> decltype(a + a);
14 typedef auto (*PFun)(int a) -> decltype(a + a);
16 void g(auto (*f)() -> int) {
18 catch (auto (&f)() -> int) { }
19 catch (auto (*const f[10])() -> int) { }
26 template<typename T> struct U {};
29 (void)typeid(auto(*)()->void);
30 (void)sizeof(auto(*)()->void);
31 (void)__alignof(auto(*)()->void);
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);
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 { };
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.