Mercurial > dwindows
annotate acinclude.m4 @ 2991:81f9399b11c8
Mac/iOS: Fix exported API function definitions reported by Xcode.
Added missing APIs on functions, not necessary on Mac and iOS technically
but for consistence they should be there and for future use.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 04 Apr 2023 12:05:14 +0000 |
parents | 83c17a84bc27 |
children |
rev | line source |
---|---|
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1 # generated automatically by aclocal 1.16.5 -*- Autoconf -*- |
3 | 2 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3 # Copyright (C) 1996-2021 Free Software Foundation, Inc. |
3 | 4 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5 # This file is free software; the Free Software Foundation |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
6 # gives unlimited permission to copy and/or distribute it, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
7 # with or without modifications, as long as this notice is preserved. |
3 | 8 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
9 # This program is distributed in the hope that it will be useful, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
12 # PARTICULAR PURPOSE. |
3 | 13 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
15 # =========================================================================== |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
16 # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
17 # =========================================================================== |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
18 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
19 # SYNOPSIS |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
20 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
21 # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
22 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
23 # DESCRIPTION |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
24 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
25 # Check for baseline language coverage in the compiler for the specified |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
26 # version of the C++ standard. If necessary, add switches to CXX and |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
27 # CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
28 # the respective C++ standard version. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
29 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
30 # The second argument, if specified, indicates whether you insist on an |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
31 # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
32 # -std=c++11). If neither is specified, you get whatever works, with |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
33 # preference for no added switch, and then for an extended mode. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
34 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
35 # The third argument, if specified 'mandatory' or if left unspecified, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
36 # indicates that baseline support for the specified C++ standard is |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
37 # required and that the macro should error out if no mode with that |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
38 # support is found. If specified 'optional', then configuration proceeds |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
39 # regardless, after defining HAVE_CXX${VERSION} if and only if a |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
40 # supporting mode is found. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
41 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
42 # LICENSE |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
43 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
44 # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
45 # Copyright (c) 2012 Zack Weinberg <zackw@panix.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
46 # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
47 # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
48 # Copyright (c) 2015 Paul Norman <penorman@mac.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
49 # Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
50 # Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
51 # Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
52 # Copyright (c) 2020 Jason Merrill <jason@redhat.com> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
53 # Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
54 # |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
55 # Copying and distribution of this file, with or without modification, are |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
56 # permitted in any medium without royalty provided the copyright notice |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
57 # and this notice are preserved. This file is offered as-is, without any |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
58 # warranty. |
3 | 59 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
60 #serial 15 |
3 | 61 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
62 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
63 dnl (serial version number 13). |
3 | 64 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
65 AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
66 m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
67 [$1], [14], [ax_cxx_compile_alternatives="14 1y"], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
68 [$1], [17], [ax_cxx_compile_alternatives="17 1z"], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
69 [$1], [20], [ax_cxx_compile_alternatives="20"], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
70 [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
71 m4_if([$2], [], [], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
72 [$2], [ext], [], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
73 [$2], [noext], [], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
74 [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
75 m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
76 [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
77 [$3], [optional], [ax_cxx_compile_cxx$1_required=false], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
78 [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
79 AC_LANG_PUSH([C++])dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
80 ac_success=no |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
81 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
82 m4_if([$2], [], [dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
83 AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
84 ax_cv_cxx_compile_cxx$1, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
85 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
86 [ax_cv_cxx_compile_cxx$1=yes], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
87 [ax_cv_cxx_compile_cxx$1=no])]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
88 if test x$ax_cv_cxx_compile_cxx$1 = xyes; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
89 ac_success=yes |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
90 fi]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
91 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
92 m4_if([$2], [noext], [], [dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
93 if test x$ac_success = xno; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
94 for alternative in ${ax_cxx_compile_alternatives}; do |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
95 switch="-std=gnu++${alternative}" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
96 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
97 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
98 $cachevar, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
99 [ac_save_CXX="$CXX" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
100 CXX="$CXX $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
101 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
102 [eval $cachevar=yes], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
103 [eval $cachevar=no]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
104 CXX="$ac_save_CXX"]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
105 if eval test x\$$cachevar = xyes; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
106 CXX="$CXX $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
107 if test -n "$CXXCPP" ; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
108 CXXCPP="$CXXCPP $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
109 fi |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
110 ac_success=yes |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
111 break |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
112 fi |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
113 done |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
114 fi]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
115 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
116 m4_if([$2], [ext], [], [dnl |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
117 if test x$ac_success = xno; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
118 dnl HP's aCC needs +std=c++11 according to: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
119 dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
120 dnl Cray's crayCC needs "-h std=c++11" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
121 for alternative in ${ax_cxx_compile_alternatives}; do |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
122 for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
123 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
124 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
125 $cachevar, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
126 [ac_save_CXX="$CXX" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
127 CXX="$CXX $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
128 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
129 [eval $cachevar=yes], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
130 [eval $cachevar=no]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
131 CXX="$ac_save_CXX"]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
132 if eval test x\$$cachevar = xyes; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
133 CXX="$CXX $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
134 if test -n "$CXXCPP" ; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
135 CXXCPP="$CXXCPP $switch" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
136 fi |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
137 ac_success=yes |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
138 break |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
139 fi |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
140 done |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
141 if test x$ac_success = xyes; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
142 break |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
143 fi |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
144 done |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
145 fi]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
146 AC_LANG_POP([C++]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
147 if test x$ax_cxx_compile_cxx$1_required = xtrue; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
148 if test x$ac_success = xno; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
149 AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
150 fi |
3 | 151 fi |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
152 if test x$ac_success = xno; then |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
153 HAVE_CXX$1=0 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
154 AC_MSG_NOTICE([No compiler with C++$1 support was found]) |
3 | 155 else |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
156 HAVE_CXX$1=1 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
157 AC_DEFINE(HAVE_CXX$1,1, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
158 [define if the compiler supports basic C++$1 syntax]) |
3 | 159 fi |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
160 AC_SUBST(HAVE_CXX$1) |
3 | 161 ]) |
162 | |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
163 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
164 dnl Test body for checking C++11 support |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
165 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
166 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
167 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
168 ) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
169 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
170 dnl Test body for checking C++14 support |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
171 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
172 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
173 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
174 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
175 ) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
176 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
177 dnl Test body for checking C++17 support |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
178 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
179 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
180 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
181 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
182 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
183 ) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
184 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
185 dnl Test body for checking C++20 support |
3 | 186 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
187 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
188 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
189 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
190 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
191 _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
192 ) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
193 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
194 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
195 dnl Tests for new features in C++11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
196 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
197 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ |
3 | 198 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
199 // If the compiler admits that it is not ready for C++11, why torture it? |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
200 // Hopefully, this will speed up the test. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
201 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
202 #ifndef __cplusplus |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
203 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
204 #error "This is not a C++ compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
205 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
206 // MSVC always sets __cplusplus to 199711L in older versions; newer versions |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
207 // only set it correctly if /Zc:__cplusplus is specified as well as a |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
208 // /std:c++NN switch: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
209 // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
210 #elif __cplusplus < 201103L && !defined _MSC_VER |
3 | 211 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
212 #error "This is not a C++11 compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
213 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
214 #else |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
215 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
216 namespace cxx11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
217 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
218 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
219 namespace test_static_assert |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
220 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
221 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
222 template <typename T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
223 struct check |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
224 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
225 static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
226 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
227 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
228 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
229 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
230 namespace test_final_override |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
231 { |
3 | 232 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
233 struct Base |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
234 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
235 virtual ~Base() {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
236 virtual void f() {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
237 }; |
3 | 238 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
239 struct Derived : public Base |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
240 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
241 virtual ~Derived() override {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
242 virtual void f() override {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
243 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
244 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
245 } |
3 | 246 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
247 namespace test_double_right_angle_brackets |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
248 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
249 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
250 template < typename T > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
251 struct check {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
252 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
253 typedef check<void> single_type; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
254 typedef check<check<void>> double_type; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
255 typedef check<check<check<void>>> triple_type; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
256 typedef check<check<check<check<void>>>> quadruple_type; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
257 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
258 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
259 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
260 namespace test_decltype |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
261 { |
3 | 262 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
263 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
264 f() |
3 | 265 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
266 int a = 1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
267 decltype(a) b = 2; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
268 return a + b; |
3 | 269 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
270 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
271 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
272 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
273 namespace test_type_deduction |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
274 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
275 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
276 template < typename T1, typename T2 > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
277 struct is_same |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
278 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
279 static const bool value = false; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
280 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
281 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
282 template < typename T > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
283 struct is_same<T, T> |
3 | 284 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
285 static const bool value = true; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
286 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
287 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
288 template < typename T1, typename T2 > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
289 auto |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
290 add(T1 a1, T2 a2) -> decltype(a1 + a2) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
291 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
292 return a1 + a2; |
3 | 293 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
294 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
295 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
296 test(const int c, volatile int v) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
297 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
298 static_assert(is_same<int, decltype(0)>::value == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
299 static_assert(is_same<int, decltype(c)>::value == false, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
300 static_assert(is_same<int, decltype(v)>::value == false, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
301 auto ac = c; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
302 auto av = v; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
303 auto sumi = ac + av + 'x'; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
304 auto sumf = ac + av + 1.0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
305 static_assert(is_same<int, decltype(ac)>::value == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
306 static_assert(is_same<int, decltype(av)>::value == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
307 static_assert(is_same<int, decltype(sumi)>::value == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
308 static_assert(is_same<int, decltype(sumf)>::value == false, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
309 static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
310 return (sumf > 0.0) ? sumi : add(c, v); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
311 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
312 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
313 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
314 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
315 namespace test_noexcept |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
316 { |
3 | 317 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
318 int f() { return 0; } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
319 int g() noexcept { return 0; } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
320 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
321 static_assert(noexcept(f()) == false, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
322 static_assert(noexcept(g()) == true, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
323 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
324 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
325 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
326 namespace test_constexpr |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
327 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
328 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
329 template < typename CharT > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
330 unsigned long constexpr |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
331 strlen_c_r(const CharT *const s, const unsigned long acc) noexcept |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
332 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
333 return *s ? strlen_c_r(s + 1, acc + 1) : acc; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
334 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
335 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
336 template < typename CharT > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
337 unsigned long constexpr |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
338 strlen_c(const CharT *const s) noexcept |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
339 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
340 return strlen_c_r(s, 0UL); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
341 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
342 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
343 static_assert(strlen_c("") == 0UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
344 static_assert(strlen_c("1") == 1UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
345 static_assert(strlen_c("example") == 7UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
346 static_assert(strlen_c("another\0example") == 7UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
347 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
348 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
349 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
350 namespace test_rvalue_references |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
351 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
352 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
353 template < int N > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
354 struct answer |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
355 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
356 static constexpr int value = N; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
357 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
358 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
359 answer<1> f(int&) { return answer<1>(); } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
360 answer<2> f(const int&) { return answer<2>(); } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
361 answer<3> f(int&&) { return answer<3>(); } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
362 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
363 void |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
364 test() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
365 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
366 int i = 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
367 const int c = 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
368 static_assert(decltype(f(i))::value == 1, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
369 static_assert(decltype(f(c))::value == 2, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
370 static_assert(decltype(f(0))::value == 3, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
371 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
372 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
373 } |
3 | 374 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
375 namespace test_uniform_initialization |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
376 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
377 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
378 struct test |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
379 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
380 static const int zero {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
381 static const int one {1}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
382 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
383 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
384 static_assert(test::zero == 0, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
385 static_assert(test::one == 1, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
386 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
387 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
388 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
389 namespace test_lambdas |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
390 { |
3 | 391 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
392 void |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
393 test1() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
394 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
395 auto lambda1 = [](){}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
396 auto lambda2 = lambda1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
397 lambda1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
398 lambda2(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
399 } |
3 | 400 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
401 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
402 test2() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
403 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
404 auto a = [](int i, int j){ return i + j; }(1, 2); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
405 auto b = []() -> int { return '0'; }(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
406 auto c = [=](){ return a + b; }(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
407 auto d = [&](){ return c; }(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
408 auto e = [a, &b](int x) mutable { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
409 const auto identity = [](int y){ return y; }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
410 for (auto i = 0; i < a; ++i) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
411 a += b--; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
412 return x + identity(a + b); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
413 }(0); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
414 return a + b + c + d + e; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
415 } |
3 | 416 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
417 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
418 test3() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
419 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
420 const auto nullary = [](){ return 0; }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
421 const auto unary = [](int x){ return x; }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
422 using nullary_t = decltype(nullary); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
423 using unary_t = decltype(unary); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
424 const auto higher1st = [](nullary_t f){ return f(); }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
425 const auto higher2nd = [unary](nullary_t f1){ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
426 return [unary, f1](unary_t f2){ return f2(unary(f1())); }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
427 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
428 return higher1st(nullary) + higher2nd(nullary)(unary); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
429 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
430 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
431 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
432 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
433 namespace test_variadic_templates |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
434 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
435 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
436 template <int...> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
437 struct sum; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
438 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
439 template <int N0, int... N1toN> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
440 struct sum<N0, N1toN...> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
441 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
442 static constexpr auto value = N0 + sum<N1toN...>::value; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
443 }; |
3 | 444 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
445 template <> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
446 struct sum<> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
447 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
448 static constexpr auto value = 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
449 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
450 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
451 static_assert(sum<>::value == 0, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
452 static_assert(sum<1>::value == 1, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
453 static_assert(sum<23>::value == 23, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
454 static_assert(sum<1, 2>::value == 3, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
455 static_assert(sum<5, 5, 11>::value == 21, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
456 static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
457 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
458 } |
3 | 459 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
460 // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
461 // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
462 // because of this. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
463 namespace test_template_alias_sfinae |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
464 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
465 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
466 struct foo {}; |
3 | 467 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
468 template<typename T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
469 using member = typename T::member_type; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
470 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
471 template<typename T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
472 void func(...) {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
473 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
474 template<typename T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
475 void func(member<T>*) {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
476 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
477 void test(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
478 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
479 void test() { func<foo>(0); } |
3 | 480 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
481 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
482 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
483 } // namespace cxx11 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
484 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
485 #endif // __cplusplus >= 201103L |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
486 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
487 ]]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
488 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
489 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
490 dnl Tests for new features in C++14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
491 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
492 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
493 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
494 // If the compiler admits that it is not ready for C++14, why torture it? |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
495 // Hopefully, this will speed up the test. |
3 | 496 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
497 #ifndef __cplusplus |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
498 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
499 #error "This is not a C++ compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
500 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
501 #elif __cplusplus < 201402L && !defined _MSC_VER |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
502 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
503 #error "This is not a C++14 compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
504 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
505 #else |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
506 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
507 namespace cxx14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
508 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
509 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
510 namespace test_polymorphic_lambdas |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
511 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
512 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
513 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
514 test() |
3 | 515 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
516 const auto lambda = [](auto&&... args){ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
517 const auto istiny = [](auto x){ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
518 return (sizeof(x) == 1UL) ? 1 : 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
519 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
520 const int aretiny[] = { istiny(args)... }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
521 return aretiny[0]; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
522 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
523 return lambda(1, 1L, 1.0f, '1'); |
3 | 524 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
525 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
526 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
527 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
528 namespace test_binary_literals |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
529 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
530 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
531 constexpr auto ivii = 0b0000000000101010; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
532 static_assert(ivii == 42, "wrong value"); |
3 | 533 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
534 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
535 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
536 namespace test_generalized_constexpr |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
537 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
538 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
539 template < typename CharT > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
540 constexpr unsigned long |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
541 strlen_c(const CharT *const s) noexcept |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
542 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
543 auto length = 0UL; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
544 for (auto p = s; *p; ++p) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
545 ++length; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
546 return length; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
547 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
548 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
549 static_assert(strlen_c("") == 0UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
550 static_assert(strlen_c("x") == 1UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
551 static_assert(strlen_c("test") == 4UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
552 static_assert(strlen_c("another\0test") == 7UL, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
553 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
554 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
555 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
556 namespace test_lambda_init_capture |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
557 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
558 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
559 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
560 test() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
561 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
562 auto x = 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
563 const auto lambda1 = [a = x](int b){ return a + b; }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
564 const auto lambda2 = [a = lambda1(x)](){ return a; }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
565 return lambda2(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
566 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
567 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
568 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
569 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
570 namespace test_digit_separators |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
571 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
572 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
573 constexpr auto ten_million = 100'000'000; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
574 static_assert(ten_million == 100000000, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
575 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
576 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
577 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
578 namespace test_return_type_deduction |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
579 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
580 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
581 auto f(int& x) { return x; } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
582 decltype(auto) g(int& x) { return x; } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
583 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
584 template < typename T1, typename T2 > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
585 struct is_same |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
586 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
587 static constexpr auto value = false; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
588 }; |
3 | 589 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
590 template < typename T > |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
591 struct is_same<T, T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
592 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
593 static constexpr auto value = true; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
594 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
595 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
596 int |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
597 test() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
598 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
599 auto x = 0; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
600 static_assert(is_same<int, decltype(f(x))>::value, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
601 static_assert(is_same<int&, decltype(g(x))>::value, ""); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
602 return x; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
603 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
604 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
605 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
606 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
607 } // namespace cxx14 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
608 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
609 #endif // __cplusplus >= 201402L |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
610 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
611 ]]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
612 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
613 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
614 dnl Tests for new features in C++17 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
615 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
616 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
617 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
618 // If the compiler admits that it is not ready for C++17, why torture it? |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
619 // Hopefully, this will speed up the test. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
620 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
621 #ifndef __cplusplus |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
622 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
623 #error "This is not a C++ compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
624 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
625 #elif __cplusplus < 201703L && !defined _MSC_VER |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
626 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
627 #error "This is not a C++17 compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
628 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
629 #else |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
630 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
631 #include <initializer_list> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
632 #include <utility> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
633 #include <type_traits> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
634 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
635 namespace cxx17 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
636 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
637 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
638 namespace test_constexpr_lambdas |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
639 { |
3 | 640 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
641 constexpr int foo = [](){return 42;}(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
642 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
643 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
644 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
645 namespace test::nested_namespace::definitions |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
646 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
647 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
648 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
649 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
650 namespace test_fold_expression |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
651 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
652 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
653 template<typename... Args> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
654 int multiply(Args... args) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
655 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
656 return (args * ... * 1); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
657 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
658 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
659 template<typename... Args> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
660 bool all(Args... args) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
661 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
662 return (args && ...); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
663 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
664 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
665 } |
3 | 666 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
667 namespace test_extended_static_assert |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
668 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
669 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
670 static_assert (true); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
671 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
672 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
673 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
674 namespace test_auto_brace_init_list |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
675 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
676 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
677 auto foo = {5}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
678 auto bar {5}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
679 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
680 static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
681 static_assert(std::is_same<int, decltype(bar)>::value); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
682 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
683 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
684 namespace test_typename_in_template_template_parameter |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
685 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
686 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
687 template<template<typename> typename X> struct D; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
688 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
689 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
690 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
691 namespace test_fallthrough_nodiscard_maybe_unused_attributes |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
692 { |
3 | 693 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
694 int f1() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
695 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
696 return 42; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
697 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
698 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
699 [[nodiscard]] int f2() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
700 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
701 [[maybe_unused]] auto unused = f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
702 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
703 switch (f1()) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
704 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
705 case 17: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
706 f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
707 [[fallthrough]]; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
708 case 42: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
709 f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
710 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
711 return f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
712 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
713 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
714 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
715 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
716 namespace test_extended_aggregate_initialization |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
717 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
718 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
719 struct base1 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
720 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
721 int b1, b2 = 42; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
722 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
723 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
724 struct base2 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
725 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
726 base2() { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
727 b3 = 42; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
728 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
729 int b3; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
730 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
731 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
732 struct derived : base1, base2 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
733 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
734 int d; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
735 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
736 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
737 derived d1 {{1, 2}, {}, 4}; // full initialization |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
738 derived d2 {{}, {}, 4}; // value-initialized bases |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
739 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
740 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
741 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
742 namespace test_general_range_based_for_loop |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
743 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
744 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
745 struct iter |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
746 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
747 int i; |
3 | 748 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
749 int& operator* () |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
750 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
751 return i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
752 } |
3 | 753 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
754 const int& operator* () const |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
755 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
756 return i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
757 } |
3 | 758 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
759 iter& operator++() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
760 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
761 ++i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
762 return *this; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
763 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
764 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
765 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
766 struct sentinel |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
767 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
768 int i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
769 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
770 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
771 bool operator== (const iter& i, const sentinel& s) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
772 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
773 return i.i == s.i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
774 } |
3 | 775 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
776 bool operator!= (const iter& i, const sentinel& s) |
3 | 777 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
778 return !(i == s); |
3 | 779 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
780 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
781 struct range |
3 | 782 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
783 iter begin() const |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
784 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
785 return {0}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
786 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
787 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
788 sentinel end() const |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
789 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
790 return {5}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
791 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
792 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
793 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
794 void f() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
795 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
796 range r {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
797 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
798 for (auto i : r) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
799 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
800 [[maybe_unused]] auto v = i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
801 } |
3 | 802 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
803 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
804 } |
3 | 805 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
806 namespace test_lambda_capture_asterisk_this_by_value |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
807 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
808 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
809 struct t |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
810 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
811 int i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
812 int foo() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
813 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
814 return [*this]() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
815 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
816 return i; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
817 }(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
818 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
819 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
820 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
821 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
822 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
823 namespace test_enum_class_construction |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
824 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
825 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
826 enum class byte : unsigned char |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
827 {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
828 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
829 byte foo {42}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
830 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
831 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
832 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
833 namespace test_constexpr_if |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
834 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
835 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
836 template <bool cond> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
837 int f () |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
838 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
839 if constexpr(cond) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
840 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
841 return 13; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
842 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
843 else |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
844 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
845 return 42; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
846 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
847 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
848 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
849 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
850 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
851 namespace test_selection_statement_with_initializer |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
852 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
853 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
854 int f() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
855 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
856 return 13; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
857 } |
3 | 858 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
859 int f2() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
860 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
861 if (auto i = f(); i > 0) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
862 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
863 return 3; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
864 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
865 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
866 switch (auto i = f(); i + 4) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
867 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
868 case 17: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
869 return 2; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
870 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
871 default: |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
872 return 1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
873 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
874 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
875 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
876 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
877 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
878 namespace test_template_argument_deduction_for_class_templates |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
879 { |
3 | 880 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
881 template <typename T1, typename T2> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
882 struct pair |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
883 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
884 pair (T1 p1, T2 p2) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
885 : m1 {p1}, |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
886 m2 {p2} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
887 {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
888 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
889 T1 m1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
890 T2 m2; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
891 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
892 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
893 void f() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
894 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
895 [[maybe_unused]] auto p = pair{13, 42u}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
896 } |
3 | 897 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
898 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
899 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
900 namespace test_non_type_auto_template_parameters |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
901 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
902 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
903 template <auto n> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
904 struct B |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
905 {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
906 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
907 B<5> b1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
908 B<'a'> b2; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
909 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
910 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
911 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
912 namespace test_structured_bindings |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
913 { |
3 | 914 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
915 int arr[2] = { 1, 2 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
916 std::pair<int, int> pr = { 1, 2 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
917 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
918 auto f1() -> int(&)[2] |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
919 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
920 return arr; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
921 } |
3 | 922 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
923 auto f2() -> std::pair<int, int>& |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
924 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
925 return pr; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
926 } |
3 | 927 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
928 struct S |
3 | 929 { |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
930 int x1 : 2; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
931 volatile double y1; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
932 }; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
933 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
934 S f3() |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
935 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
936 return {}; |
3 | 937 } |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
938 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
939 auto [ x1, y1 ] = f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
940 auto& [ xr1, yr1 ] = f1(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
941 auto [ x2, y2 ] = f2(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
942 auto& [ xr2, yr2 ] = f2(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
943 const auto [ x3, y3 ] = f3(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
944 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
945 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
946 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
947 namespace test_exception_spec_type_system |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
948 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
949 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
950 struct Good {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
951 struct Bad {}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
952 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
953 void g1() noexcept; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
954 void g2(); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
955 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
956 template<typename T> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
957 Bad |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
958 f(T*, T*); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
959 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
960 template<typename T1, typename T2> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
961 Good |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
962 f(T1*, T2*); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
963 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
964 static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
965 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
966 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
967 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
968 namespace test_inline_variables |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
969 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
970 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
971 template<class T> void f(T) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
972 {} |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
973 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
974 template<class T> inline T g(T) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
975 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
976 return T{}; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
977 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
978 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
979 template<> inline void f<>(int) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
980 {} |
3 | 981 |
2970
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
982 template<> int g<>(int) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
983 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
984 return 5; |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
985 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
986 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
987 } |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
988 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
989 } // namespace cxx17 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
990 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
991 #endif // __cplusplus < 201703L && !defined _MSC_VER |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
992 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
993 ]]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
994 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
995 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
996 dnl Tests for new features in C++20 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
997 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
998 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
999 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1000 #ifndef __cplusplus |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1001 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1002 #error "This is not a C++ compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1003 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1004 #elif __cplusplus < 202002L && !defined _MSC_VER |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1005 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1006 #error "This is not a C++20 compiler" |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1007 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1008 #else |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1009 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1010 #include <version> |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1011 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1012 namespace cxx20 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1013 { |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1014 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1015 // As C++20 supports feature test macros in the standard, there is no |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1016 // immediate need to actually test for feature availability on the |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1017 // Autoconf side. |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1018 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1019 } // namespace cxx20 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1020 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1021 #endif // __cplusplus < 202002L && !defined _MSC_VER |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1022 |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1023 ]]) |
83c17a84bc27
Update the configure scripts with the latest autotools.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1024 |