view gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C @ 131:84e7813d76e9

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

// PR c++/58281 - Problem with explicitly instantiated constexpr template
//     functions 
// { dg-do compile { target c++11 } }
// { dg-options "-fdump-tree-optimized" }


template <typename T>
constexpr bool f (T a)
{
  return a == 3;
}

extern template bool f<int>(int);

bool g (int x) { return f (x); }

template bool f<int>(int);

// Verify that the defintions of both f() and g() are emitted.
// { dg-final { scan-tree-dump-times ";; Function f" 1 "optimized" } }
// { dg-final { scan-tree-dump-times ";; Function g" 1 "optimized" } }