[Bug c++/64603] New: [5 Regression] bogus error "no matching function for call to ..." with templates

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 14 21:22:00 GMT 2015


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

            Bug ID: 64603
           Summary: [5 Regression] bogus error "no matching function for
                    call to ..." with templates
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janus at gcc dot gnu.org

Created attachment 34452
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34452&action=edit
source file

The attached source file compiles fine with g++ 4.9.1, 4.8.3 and 4.7.4.

However, it is rejected with current trunk builds:

$ g++-5.0 logging.cc -std=c++11
logging.cc: In function ‘void create_all_loggers()’:
logging.cc:33:62: error: no matching function for call to
‘create_all_loggers_impl()’
   create_all_loggers_impl<std::tuple_size<AreaTuple>::value>();
                                                              ^
logging.cc:26:52: note: candidate: template<long unsigned int index, int
<anonymous> > typename std::enable_if<(index == 0)>::type
create_all_loggers_impl()
 inline typename std::enable_if<(index == 0)>::type create_all_loggers_impl()
{}
                                                    ^
logging.cc:26:52: note:   template argument deduction/substitution failed:
logging.cc: In substitution of ‘template<long unsigned int index, int
<anonymous> > typename std::enable_if<(index == 0)>::type
create_all_loggers_impl() [with long unsigned int index = 1ul; int <anonymous>
= <missing>]’:
logging.cc:33:62:   required from here
logging.cc:26:52: error: no type named ‘type’ in ‘struct std::enable_if<false,
void>’
logging.cc:30:52: note: candidate: template<long unsigned int index, int
longest_name> typename std::enable_if<(index != 0)>::type
create_all_loggers_impl()
 inline typename std::enable_if<(index != 0)>::type create_all_loggers_impl()
{}
                                                    ^
logging.cc:30:52: note:   template argument deduction/substitution failed:
logging.cc:29:61:   in constexpr expansion of ‘find_longest_logger_name<1ul>()’
logging.cc:29:62: error: ‘(((int)(((unsigned int)5ul) + 4294967295u)) > 0)’ is
not a constant expression
           int longest_name = find_longest_logger_name<index>()>
                                                              ^
logging.cc:29:62: note: in template argument for type ‘int’


More information about the Gcc-bugs mailing list