From 6373d2a204abe38683a3d5f39ad7a140c12c2482 Mon Sep 17 00:00:00 2001 From: msebor Date: Wed, 16 Mar 2016 03:00:02 +0000 Subject: [PATCH] PR c++/58281 - Problem with explicitly instantiated constexpr template functions gcc/testsuite/ChangeLog: 2016-03-15 Martin Sebor PR c++/58281 * g++.dg/cpp1y/constexpr-instantiate.C: Add new test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234246 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ .../g++.dg/cpp1y/constexpr-instantiate.C | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06ec23e92626..2e25991cc4dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 Martin Sebor + + PR c++/58281 + * g++.dg/cpp1y/constexpr-instantiate.C: Add new test. + 2016-03-15 John David Anglin * gcc.c-torture/execute/pr68532.c: Add -fno-common option on diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C new file mode 100644 index 000000000000..73d0508476b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C @@ -0,0 +1,20 @@ +// PR c++/58281 - Problem with explicitly instantiated constexpr template +// functions +// { dg-do compile { target c++11 } } +// { do-additional-options "-fdump-tree-optimized" } + + +template +constexpr bool f (T a) +{ + return a == 3; +} + +extern template bool f(int); + +bool g (int x) { return f (x); } + +template bool f(int); + +// Verify that the defintions of both f() and g() are emitted. +// { dg-final { scan-tree-dump "bool \[fg\](" "optimized" } } -- 2.47.3