view gcc/testsuite/g++.dg/warn/pr94038-2.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
line wrap: on
line source

// PR c++/94038
// { dg-do compile { target c++11 } }
// { dg-additional-options "-O -Wall" }

static constexpr int x = 0;

template<typename T>
constexpr const int&
foo()
{
  static_assert(T(1) == 0, "");
  return x;
}

template<typename T>
constexpr const int&
bar()
{
  return foo<T>();
}

constexpr int
baz(int a)
{
  return a;
}

static_assert(decltype(baz(bar<int>())){} == 0, "");