Bug 58915 - g++ can't find function template
g++ can't find function template
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-01-27 15:24 EST by ksvanhorn
Modified: 2007-04-18 12:39 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-01-27 15:24:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description ksvanhorn 2002-01-27 15:24:27 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i586)

Description of problem:
g++ can't find a function template with the signature
template <typename T, size_t N>
inline size_t arrsz(T const A[N])

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Save the file under "additional information" to "example_error.cc".
2. Run g++ example_error.cc.


Actual Results:  example_error.cc: In function `int main (int, char **)':
example_error.cc:14: no matching function for call to `arrsz (const 

Expected Results:  Successful compilation.

Additional info:

#include <cstdlib>

using namespace std;

template <typename T, size_t N>
  inline size_t
  arrsz(T const A[N]) {
    return N;

int main(int argc, char * * argv)
  int const A[] = { 1, 5, 7, 4, 13, 10 };
  int const * Aend = A + arrsz(A);
  return 0;
Comment 1 Jakub Jelinek 2002-01-28 04:54:42 EST
That's correct, check ISO C++ 98.
To make this work, you can e.g. use arrsz<int,6>(A) instead of arrsz(A).

Note You need to log in before you can comment on or make changes to this bug.