static inline template

I’ve been having a problem compiling octave and this is a simple example of what I’m running into. Is the following valid C++ and there’s a compiler error, or does it not conform to the standard? If the latter can you point to to a chapter/verse?

[chulbert@hulbert64 ~]$ pgCC -Minform=inform
“”, line 10: error: a storage class may not be specified here
static inline void a (int &x)

1 error detected in the compilation of “”.
[chulbert@hulbert64 ~]$ g++ -Wall -pedantic
[chulbert@hulbert64 ~]$ cat
#include <stdlib.h>

static inline void a (T &x)

template <>
static inline void a (int &x)

int main(void)
int y = -1;
return y;
[chulbert@hulbert64 ~]$

Hi Chris,

From one of our C++ engineers:

The test case below is nonstandard: paragraph 7.1.1/1 of the
standard says (among other things):

“A storage-class-specifier shall not be specified in
an explicit specialization […]”

However, we are considering it a GNU compatabilty issue and have entered a feature request (TPR#3968). Support for this feature should be available in a future release.


FYI, this feature has been added as of the PGI 2010 compilers.

  • Mat