diff options
author | Jason Merrill <jason@redhat.com> | 2015-08-12 13:33:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-08-12 13:33:39 -0400 |
commit | 4757fa7f0ba01e207b313c2931312555d5ec98bf (patch) | |
tree | 8b878b690b6ca0db3a43e5eca10ba2528c8ef0b7 | |
parent | b893e375096038ac99521a97b7fa346b016bdb78 (diff) | |
download | gcc-4757fa7f0ba01e207b313c2931312555d5ec98bf.zip gcc-4757fa7f0ba01e207b313c2931312555d5ec98bf.tar.gz gcc-4757fa7f0ba01e207b313c2931312555d5ec98bf.tar.bz2 |
re PR c++/67161 (ICE with a static_assert using our internal __not/__or/__and traits)
PR c++/67161
* error.c (dump_decl) [TEMPLATE_ID_EXPR]: Pass
TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS.
From-SVN: r226827
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/error.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ44.C | 29 |
3 files changed, 37 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cdbe719..bed0a5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-08-12 Jason Merrill <jason@redhat.com> + + PR c++/67161 + * error.c (dump_decl) [TEMPLATE_ID_EXPR]: Pass + TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS. + 2015-08-08 Jason Merrill <jason@redhat.com> PR c++/67152 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 4f85751..ae3e092 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1212,7 +1212,8 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) if (args == error_mark_node) pp_string (pp, M_("<template arguments error>")); else if (args) - dump_template_argument_list (pp, args, flags); + dump_template_argument_list + (pp, args, flags|TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS); pp_cxx_end_template_argument_list (pp); } break; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ44.C b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C new file mode 100644 index 0000000..2fc21a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C @@ -0,0 +1,29 @@ +// PR c++/67161 +// { dg-do compile { target c++14 } } + +template <typename _Tp> struct integral_constant { + static constexpr _Tp value = 0; +}; +template <bool, typename, typename> struct conditional; +template <typename...> struct __or_; +template <typename _B1, typename _B2> +struct __or_<_B1, _B2> : conditional<1, _B1, _B2>::type {}; +template <typename...> struct __and_; +template <typename> struct __not_ : integral_constant<bool> {}; +template <typename> struct __is_void_helper : integral_constant<bool> {}; +template <typename> struct is_void : __is_void_helper<int> {}; +template <bool, typename _Iftrue, typename> struct conditional { + typedef _Iftrue type; +}; +template <bool _Cond, typename _Iftrue, typename _Iffalse> +using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; +template <typename...> using common_type_t = int; +template <typename, int> struct array {}; +template <typename _Tp> constexpr int is_void_v = is_void<_Tp>::value; +template <typename _Dest = void, typename... _Types> +constexpr auto make_array() + -> array<conditional_t<is_void_v<_Dest>, common_type_t<>, _Dest>, + sizeof...(_Types)> { + static_assert(__or_<__not_<is_void<_Dest>>, __and_<>>::value, ""); // { dg-error "static assert" } +} +auto d = make_array(); |