[Bug c++/63362] The c++11 triviality-traits need front-end help

ville.voutilainen at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 7 18:03:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63362

--- Comment #20 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Jason Merrill from comment #19)
> (In reply to Ville Voutilainen from comment #18)
> > to work just fine. Yet this particular test will not work with my
> > modifications, but works without them (I just tested that).
> 
> Attach a preprocessed file that ICEs?

The presence of a libiberty hash operation
and comptypes would suggest that it's something to do with the lookup of
templates,
when there's already a template that is more or less similar, and then
a definition of another one quite like it with a different name...

This test fails even without my changes in type_traits:

#include <type_traits>

template <typename T, class... Args>
struct mytrait : public std::__and_<std::is_constructible<T, Args...>,
std::integral_constant<bool,
            __is_trivially_constructible(T, Args...)>>::type
{
};

template <typename T, class... Args>
struct mytrait2 : public std::__and_<std::is_constructible<T, Args...>,
std::integral_constant<bool,
            __is_trivially_constructible(T, Args...)>>::type
{
};

Ok, I can even reduce it, again:

template <bool b> struct bool_
{
};

template <typename T, class... Args>
struct mytrait : bool_<__is_trivially_constructible(T, Args...)>
{
};

template <typename T, class... Args>
struct mytrait2 : bool_<__is_trivially_constructible(T, Args...)>
{
};

[ville@localhost ~]$ g++ --std=c++14 -c trivial_trait3.cpp
trivial_trait3.cpp:11:65: internal compiler error: tree check: expected class
‘type’, have ‘exceptional’ (tree_list) in comptypes, at cp/typeck.c:1391
 struct mytrait2 : bool_<__is_trivially_constructible(T, Args...)>
                                                                 ^
0xe07427 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
    ../../gcc/tree.c:9226
0x6b4f50 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
    ../../gcc/tree.h:2856
0x6b4f50 comptypes(tree_node*, tree_node*, int)
    ../../gcc/cp/typeck.c:1391
0x5c2934 template_args_equal
    ../../gcc/cp/pt.c:7223
0x5c2fbe comp_template_args_with_info
    ../../gcc/cp/pt.c:7250
0x5c30ec comp_template_args(tree_node*, tree_node*)
    ../../gcc/cp/pt.c:7268
0x5c30ec eq_specializations
    ../../gcc/cp/pt.c:1512
0x123c2c4 htab_find_with_hash
    ../../libiberty/hashtab.c:598
0x5e9b31 lookup_template_class_1
    ../../gcc/cp/pt.c:7688
0x5e9b31 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
    ../../gcc/cp/pt.c:7979
0x700da2 finish_template_type(tree_node*, tree_node*, int)
    ../../gcc/cp/semantics.c:2981
0x6936e9 cp_parser_template_id
    ../../gcc/cp/parser.c:13658
0x6939f8 cp_parser_class_name
    ../../gcc/cp/parser.c:19487
0x687b4a cp_parser_qualifying_entity
    ../../gcc/cp/parser.c:5570
0x687b4a cp_parser_nested_name_specifier_opt
    ../../gcc/cp/parser.c:5295
0x67aae9 cp_parser_base_specifier
    ../../gcc/cp/parser.c:21231
0x67aae9 cp_parser_base_clause
    ../../gcc/cp/parser.c:21080
0x67aae9 cp_parser_class_head
    ../../gcc/cp/parser.c:20293
0x67aae9 cp_parser_class_specifier_1
    ../../gcc/cp/parser.c:19567
0x67b990 cp_parser_class_specifier
    ../../gcc/cp/parser.c:19859
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


More information about the Gcc-bugs mailing list