#1671 invalid default argument in redeclaration
Metadata
Property | Value |
---|---|
Reported by | Andreas Nüßing (a.nuessing@uni-muenster.de) |
Reported at | Jun 17, 2015 12:00 |
Type | Bug Report |
Version | Git (pre2.4) [cmake] |
Operating System | Unspecified / All |
Last edited by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Last edited at | Jun 17, 2015 19:53 |
Closed by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Closed at | Jun 17, 2015 19:53 |
Closed in version | Unknown |
Resolution | Fixed |
Comment |
Description
The standard states (8.3.6/4) that adding default arguments in later function declarations are only valid for non-template functions. In matrixmarket.hh, the function template loadMatrixMarket is declared and a default argument for the last parameter is provided. In owneroverlapcopy.hh, OwnerOverlapCopyCommunication contains a friend declaration of loadMatrixMarket without the default parameter. If now owneroverlapcopy.hh is included before matrixmarket.hh, the friend declaration is the first declaration and the default parameter in matrixmarket.hh is invalid. gcc <= 4.9.2 simply ignores the default argument in such a case, gcc 5.1 and clang >= 3.0 fail to compile. The attached patch (against the current istl master 0974d24) includes matrixmarket.hh in owneroverlapcopy.hh to make sure that the declaration which provides the default argument is always the first one.