// RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -verify // This is a test for an egregious hack in Clang that works around // an issue with GCC's implementation. std::common_type // relies on pre-standard rules for decltype(), in which it doesn't // produce reference types so frequently. #ifdef BE_THE_HEADER #pragma GCC system_header namespace std { template T &&declval(); template struct common_type {}; template struct common_type { // Under the rules in the standard, this always produces a // reference type. typedef decltype(true ? declval() : declval()) type; }; } #else #define BE_THE_HEADER #include "libstdcxx_common_type_hack.cpp" using T = int; using T = std::common_type::type; using U = int; // expected-note {{here}} using U = decltype(true ? std::declval() : std::declval()); // expected-error {{different types}} #endif