NetBSD Problem Report #53190

From rhialto@falu.nl  Mon Apr 16 20:08:14 2018
Return-Path: <rhialto@falu.nl>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2A7F27A14E
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 16 Apr 2018 20:08:14 +0000 (UTC)
Message-Id: <20180416200807.GA2822@falu.nl>
Date: Mon, 16 Apr 2018 22:08:07 +0200
From: Rhialto <rhialto@falu.nl>
Reply-To: Rhialto <rhialto@falu.nl>
To: gnats-bugs@NetBSD.org
Cc: Rhialto <rhialto@falu.nl>
Subject: 2 extra patches for news/nget for g++ 4.9.
X-Send-Pr-Version: 3.95

>Number:         53190
>Category:       pkg
>Synopsis:       2 extra patches for news/nget for g++ 4.9.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 16 20:10:00 +0000 2018
>Originator:     Rhialto
>Release:        NetBSD 7.0.1
>Organization:
>Environment:
System: NetBSD murthe.falu.nl 7.0.1 NetBSD 7.0.1 (MURTHE7.0.1) #0: Tue Jun 7 23:03:24 CEST 2016 rhialto@murthe.falu.nl:/usr/src/sys/arch/amd64/compile/MURTHE7.0.1 amd64
Architecture: x86_64
Machine: amd64
>Description:
	Building the news/nget package fails with gcc 4.9.x.
	Older compiler versions were apparently more lax with their checking of const.

	I added a template with an extra const; maybe the version without const is not needed but I didn't check.

	+pred<ClassType> *new_comparison(RetType (ClassType::*memberf)(void) const, RetType v){
	                                                                     ^^^^^ new
>How-To-Repeat:
	cd /usr/pkgsrc/news/nget && make
>Fix:
	2 new patches:

patch-etree.cc:

$NetBSD$

Improve const-correctness.

--- etree.cc.orig	2018-04-16 19:50:09.000000000 +0000
+++ etree.cc
@@ -82,6 +82,10 @@ template <template <class A, class B> cl
 pred<ClassType> *new_comparison(RetType (ClassType::*memberf)(void), RetType v){
 	return new Comparison<Op, MemfuncGetter, RetType, ClassType>(memberf, v);
 }
+template <template <class A, class B> class Op, class ClassType, class RetType>
+pred<ClassType> *new_comparison(RetType (ClassType::*memberf)(void) const, RetType v){
+	return new Comparison<Op, MemfuncGetter, RetType, ClassType>(memberf, v);
+}
 template <class ClassType, class getterT, class T2>
 pred<ClassType> *comparison(const string &opstr, getterT get, T2 v) {
 	if      (opstr.compare("==")==0) return new_comparison<Op_eq,ClassType>(get, v);
@@ -115,6 +119,10 @@ template <template <class A, class B> cl
 pred<ClassType> *new_comparison_re(RetType (ClassType::*memberf)(void), const char *pattern, int flags){
 	return new Comparison_re<Op, MemfuncGetter, RetType, ClassType>(memberf, pattern, flags);
 }
+template <template <class A, class B> class Op, class ClassType, class RetType>
+pred<ClassType> *new_comparison_re(RetType (ClassType::*memberf)(void) const, const char *pattern, int flags){
+	return new Comparison_re<Op, MemfuncGetter, RetType, ClassType>(memberf, pattern, flags);
+}
 template <class ClassType, class getterT>
 pred<ClassType> *comparison_re(const string &opstr, getterT get, const char *pattern, int flags) {
 	//typedef const string &T;


patch-getter.h:

$NetBSD$

Improve const-correctness.

--- getter.h.orig	2018-04-16 19:54:17.000000000 +0000
+++ getter.h
@@ -35,7 +35,7 @@ class MemGetter {
 template <class RetType, class ClassType>
 class MemfuncGetter {
 	private:
-		typedef RetType (ClassType::*member_t)(void);
+		typedef RetType (ClassType::*member_t)(void) const;
 		member_t member;		
 	public:
 		typedef RetType T;


-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- Wayland: Those who don't understand X
\X/ rhialto/at/falu.nl      -- are condemned to reinvent it. Poorly.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.