view gcc/testsuite/g++.dg/cpp0x/fntmpdefarg10.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// PR c++/85765
// { dg-do compile { target c++11 } }

struct il { il(); il(const il&); };

int* begin(il);

template<class T> T&& declval();

template<class T, class U = decltype(begin(declval<T&>())), decltype(*U(),0) = 0>
U g(T& t, long) { return begin(t); } // #1

template<class T>
int g(T& t, ...); // #2

volatile il a;

auto n = g(a, 0); // calls #1 and ends with a hard error, should call #2