Subject: pkg/33694: archivers/par2 fails to build using gcc4 (+fix)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <martijnb@atlas.ipv6.stack.nl>
List: pkgsrc-bugs
Date: 06/10/2006 20:45:00
>Number:         33694
>Category:       pkg
>Synopsis:       archivers/par2 fails to build using gcc4 (+fix)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 10 20:45:00 +0000 2006
>Originator:     martijnb@atlas.ipv6.stack.nl
>Release:        NetBSD 3.99.21
>Organization:
	
>Environment:
	
	
System: NetBSD atlas.ipv6.stack.nl 3.99.21 NetBSD 3.99.21 (ATLAS) #0: Sat Jun 10 12:31:01 CEST 2006 martijnb@atlas.ipv6.stack.nl:/usr/obj/sys/arch/amd64/compile/ATLAS amd64
Architecture: x86_64
Machine: amd64
>Description:
	archivers/par2 failss to build, due to the illegal declaration of template specialisations:

reedsolomon.cpp:236: error: explicit specialization of 'bool ReedSolomon<Galois<16u, 69643u, short unsigned int> >::SetInput(u32)' must be introduced by 'template <>'
reedsolomon.cpp:236: error: template-id 'SetInput<>' for 'bool ReedSolomon<Galois<16u, 69643u, short unsigned int> >::SetInput(u32)' does not match any template declaration
reedsolomon.cpp:236: error: invalid function declaration

	(few others, too)

	gcc3 accepts the wrong declaration, gcc4 is more strict in these matters.
	
>How-To-Repeat:
	try to build achivers/par2 using gcc4
>Fix:

$NetBSD$

--- reedsolomon.cpp.orig	2003-05-26 20:01:31.000000000 +0200
+++ reedsolomon.cpp
@@ -51,7 +51,7 @@ u32 gcd(u32 a, u32 b)
   }
 }
 
-bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
+template<> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
 {
   inputcount = (u32)present.size();
 
@@ -80,7 +80,7 @@ bool ReedSolomon<Galois8>::SetInput(cons
   return true;
 }
 
-bool ReedSolomon<Galois8>::SetInput(u32 count)
+template<> bool ReedSolomon<Galois8>::SetInput(u32 count)
 {
   inputcount = count;
 
@@ -101,7 +101,7 @@ bool ReedSolomon<Galois8>::SetInput(u32 
   return true;
 }
 
-bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
+template<> bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
 {
   // Look up the appropriate element in the RS matrix
   Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
@@ -189,7 +189,7 @@ bool ReedSolomon<Galois8>::Process(size_
 
 // Set which of the source files are present and which are missing
 // and compute the base values to use for the vandermonde matrix.
-bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
+template<> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
 {
   inputcount = (u32)present.size();
 
@@ -233,7 +233,7 @@ bool ReedSolomon<Galois16>::SetInput(con
 
 // Record that the specified number of source files are all present
 // and compute the base values to use for the vandermonde matrix.
-bool ReedSolomon<Galois16>::SetInput(u32 count)
+template<> bool ReedSolomon<Galois16>::SetInput(u32 count)
 {
   inputcount = count;
 
@@ -267,7 +267,7 @@ bool ReedSolomon<Galois16>::SetInput(u32
   return true;
 }
 
-bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
+template<> bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
 {
   // Look up the appropriate element in the RS matrix
 

>Unformatted: