diff options
author | Martin Sebor <msebor@redhat.com> | 2016-03-16 03:00:02 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2016-03-15 21:00:02 -0600 |
commit | ab1caa6e04b28cc232ea3f0255ef7325c2c27b19 (patch) | |
tree | b4197e170edffb660d3a5f432cd03ef391260f8f | |
parent | 960fcebd933da37e63fafabe2586f4d188886c34 (diff) | |
download | gcc-ab1caa6e04b28cc232ea3f0255ef7325c2c27b19.zip gcc-ab1caa6e04b28cc232ea3f0255ef7325c2c27b19.tar.gz gcc-ab1caa6e04b28cc232ea3f0255ef7325c2c27b19.tar.bz2 |
PR c++/58281 - Problem with explicitly instantiated constexpr template
PR c++/58281 - Problem with explicitly instantiated constexpr template
functions
gcc/testsuite/ChangeLog:
2016-03-15 Martin Sebor <msebor@redhat.com>
PR c++/58281
* g++.dg/cpp1y/constexpr-instantiate.C: Add new test.
From-SVN: r234246
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/constexpr-instantiate.C | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 06ec23e..2e25991 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 Martin Sebor <msebor@redhat.com> + + PR c++/58281 + * g++.dg/cpp1y/constexpr-instantiate.C: Add new test. + 2016-03-15 John David Anglin <danglin@gcc.gnu.org> * 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 0000000..73d0508 --- /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 <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 "bool \[fg\](" "optimized" } } |