25 lines · cpp
1namespace ignore {2struct Dummy {};3 4template <typename T> auto auto_ret(T x) { return 0; }5[[gnu::abi_tag("test")]] int with_tag() { return 0; }6template <typename T> [[gnu::abi_tag("test")]] int with_tag_template() {7 return 0;8}9 10template <typename T> decltype(auto) decltype_auto_ret(T x) { return 0; }11} // namespace ignore12 13template <typename T>14[[gnu::abi_tag("test")]] ignore::Dummy with_tag_template_returns_ignore(T x) {15 return {};16}17 18int main() {19 auto v1 = ignore::auto_ret<int>(5);20 auto v2 = ignore::with_tag();21 auto v3 = ignore::decltype_auto_ret<int>(5);22 auto v4 = ignore::with_tag_template<int>();23 auto v5 = with_tag_template_returns_ignore<int>(5);24}25