This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36852] New: Two dimensional array in template method argument list incorrectly interpreted.
- From: "djh at emss dot co dot za" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2008 16:24:40 -0000
- Subject: [Bug c++/36852] New: Two dimensional array in template method argument list incorrectly interpreted.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
We have a class more or less like this: (please bear with me, this is only an
approximation.
class A
{
template <class T> static T determinant4(T matrix[4][4]);
template <class T> static T determinant3(T matrix[3][3]);
template <class T> static T determinant2(T matrix[2][2]);
};
template <class T>
T A::determinant3(T matrix[3][3])
{
// do stuff
}
When this header file is included in a cpp file, its compilation with gcc 4.3.1
tells me it can't find the determinant3 method.
GCC tells me:
common_Math.h:270: error: prototype for ?T common_Math::determinant3(T (*)[3])?
does not match any in class ?common_Math?
common_Math.h:179: error: candidate is: template<class T> static T
common_Math::determinant3(T (*)[3])
I have had trouble reproducing this example in an isolated environment. What I
can tell you thought is that if you modify the array to be only of single
dimension, it compiles happily.
Also all the methods that are not 3x3 matrices, the 4x4 method for example
compiles correctly.
For this instance of the compilation, T is of type double. It was compiled on
a 32 bit machine.
--
Summary: Two dimensional array in template method argument list
incorrectly interpreted.
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: djh at emss dot co dot za
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36852