Bug 58915 - g++ can't find function template
Summary: g++ can't find function template
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.1
Hardware: i686 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-01-27 20:24 UTC by ksvanhorn
Modified: 2007-04-18 16:39 UTC (History)
0 users

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

Attachments (Terms of Use)

Description ksvanhorn 2002-01-27 20:24:27 UTC
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 09:54:42 UTC
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.