diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 9 | ||||
-rw-r--r-- | tests/funcretval_test++11.cxx | 37 | ||||
-rwxr-xr-x | tests/run-funcretval++11.sh | 21 |
4 files changed, 67 insertions, 1 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 536a41ec..b9aa22ba 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -66,6 +66,7 @@ /fillfile /find-prologues /funcretval +/funcretval_test++11 /funcscopes /get-aranges /get-files diff --git a/tests/Makefile.am b/tests/Makefile.am index 36823d94..efbb4e63 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -262,6 +262,12 @@ TESTS += run-debuginfod-federation-metrics.sh endif endif +if HAVE_CXX11 +check_PROGRAMS += funcretval_test++11 +funcretval_test__11_SOURCES = funcretval_test++11.cxx +TESTS += run-funcretval++11.sh +endif + EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-ar-N.sh \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ @@ -604,7 +610,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-readelf-dw-form-indirect.sh testfile-dw-form-indirect.bz2 \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ testfile_nvidia_linemap.bz2 \ - testfile-largealign.o.bz2 run-strip-largealign.sh + testfile-largealign.o.bz2 run-strip-largealign.sh \ + run-funcretval++11.sh if USE_VALGRIND diff --git a/tests/funcretval_test++11.cxx b/tests/funcretval_test++11.cxx new file mode 100644 index 00000000..69e25bfb --- /dev/null +++ b/tests/funcretval_test++11.cxx @@ -0,0 +1,37 @@ +/* Copyright (C) 2023 IBM Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <utility> + +int & +foo () +{ + static int tmp; + return tmp; +} + +int && +bar () +{ + static int tmp; + return std::move(tmp); +} + +int +main () +{ + return 0; +} diff --git a/tests/run-funcretval++11.sh b/tests/run-funcretval++11.sh new file mode 100755 index 00000000..fcfefe19 --- /dev/null +++ b/tests/run-funcretval++11.sh @@ -0,0 +1,21 @@ +#! /bin/sh +# Copyright (C) 2023 IBM Corporation +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +testrun $abs_builddir/funcretval -e $abs_builddir/funcretval_test++11 \ + > /dev/null |