This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [12/12] Simplify uses of hash_map


On 06/26/2015 04:37 PM, Rainer Orth wrote:
> /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >]
> /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note:   template argument deduction/substitution failed:
> /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)'
> In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0,
>                  from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317,
>                  from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25:
> /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >]
> /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note:   template argument deduction/substitution failed:
> /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)'
> make: *** [c-family/cilk.o] Error 1
> 
> 	Rainer
> 

It seems that I can also reproduce this issue. The following code was
reduced from GCC r224910, genmatch.c:

$ cat ./test2.ii
template <typename Descriptor, template <typename> class> class hash_table {
  typedef typename Descriptor::value_type value_type;
  template <typename Argument, int (*)(value_type *, Argument)>
  void traverse(Argument);
};

template <typename Descriptor, template <typename> class Allocator>
template <
    typename Argument,
    int (*)(typename hash_table<Descriptor, Allocator>::value_type *,
Argument)>
void hash_table<Descriptor, Allocator>::traverse(Argument) {}

It is accepted by current GCC and Clang but rejected by EDG:

$ /opt/intel/bin/icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on
Intel(R) 64, Version 15.0.3.187 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

$ /opt/intel/bin/icpc -c ./test2.ii
./test2.ii(11): error: declaration is incompatible with function
template "void hash_table<Descriptor,
<unnamed>>::traverse<Argument,<unnamed>>(Argument)" (declared at line 4)
  void hash_table<Descriptor, Allocator>::traverse(Argument) {}
                                          ^
compilation aborted for ./test2.ii (code 2)

-- 
Regards,
    Mikhail Maltsev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]