GCC 7.2.0 c++ template / typing problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,
I am attempting to build this application http://prdownloads.sourceforge.net/nget/nget-0.27.1.tar.gz?download with gcc 7.2.0. It built faultlessly under GCC 4.2.0 but it fails with these (sample) errors under 7.2.0.

g++ -g -O2 -Wall -MMD -MP -DHAVE_CONFIG_H -std=c++1z -Wwrite-strings -Wno-deprecated   -c -o etree.o etree.cc
etree.cc: In instantiation of 'pred<ClassType>* comparison(const string&, getterT, T2) [with ClassType = const c_nntp_file; getterT = long unsigned int (c_nntp_file::*)() const; T2 = long unsigned int; std::string = std::basic_string<char>]':
etree.cc:200:81:   required from here
etree.cc:87:73: error: no matching function for call to 'new_comparison<template<class T, class T2> struct Op_eq, const c_nntp_file>(long unsigned int (c_nntp_file::*&)() const, long unsigned int&)'
  if      (opstr.compare("==")==0) return new_comparison<Op_eq,ClassType>(get, v);
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
etree.cc:78:18: note: candidate: template<template<class A, class B> class Op, class ClassType, class RetType> pred<ClassType>* new_comparison(RetType ClassType::*, RetType)
 pred<ClassType> *new_comparison(RetType (ClassType::*member), RetType v){
                  ^~~~~~~~~~~~~~
etree.cc:78:18: note:   template argument deduction/substitution failed:
etree.cc:87:73: note:   deduced conflicting types for parameter 'RetType' ('long unsigned int() const' and 'long unsigned int')
  if      (opstr.compare("==")==0) return new_comparison<Op_eq,ClassType>(get, v);
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
etree.cc:82:18: note: candidate: template<template<class A, class B> class Op, class ClassType, class RetType> pred<ClassType>* new_comparison(RetType (ClassType::*)(), RetType)
 pred<ClassType> *new_comparison(RetType (ClassType::*memberf)(void), RetType v){
                  ^~~~~~~~~~~~~~
etree.cc:82:18: note:   template argument deduction/substitution failed:
etree.cc:87:73: note:   types 'RetType (c_nntp_file::)()' and 'long unsigned int (c_nntp_file::)() const' have incompatible cv-qualifiers
  if      (opstr.compare("==")==0) return new_comparison<Op_eq,ClassType>(get, v);

etc.


I am not a C++ programmer but AIUI it is failing to find the specific function to execute in the template overload because of disagreements over typing (function return value vs a scalar, const vs non-cost etc.) and for that reason what would otherwise be a warning becomes a fatal error. Is this correct?

I was hoping one of the -std switches would revert the back to the GCC 4.2.0 behaviour and allow me to do the build but none of the -std switches I tried made any difference.

The etree.{h,cc} files and full (colourised) error report is at http://www.mklab.rhul.ac.uk/~tom/tmpetree.zip.

Any thoughts?

Many thanks
Tom Crane

--
Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill,
Egham, Surrey, TW20 0EX, England.
Email:  T.Crane@xxxxxxxxxx



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux