dimanche 27 janvier 2019

C++ template aliasing g++ 5.4

I'am not able to compile any trivial C++ aliasing declaration. Here is my dev env :

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609

Here is my snippet (file tstFrameProd.cpp):

template<typename T = double>
struct mystruct {};

template<typename T = double> using myalias = mystruct<T>;

int main(int argc, char *argv[])
{
      return 0;
}

Here is my compilation process :

g++  -g -std=c++11  -W -Wall -I../include  -I../../../Toolbox/CShmRingBuf/ -I/opt/matrox_imaging/mil/include -Woverloaded-virtual -ansi -pipe -fno-for-scope -DGNU_GCC  -DDEBUG   -c -o tstFrameProd.o tstFrameProd.cpp

Here is my compilation error message :

tstFrameProd.cpp:20:31: error: expected unqualified-id before ‘using’
 template<typename T = double> using myalias = mystruct<T>;

Any hint is very welcome.

Cheers !

Sylvain

Aucun commentaire:

Enregistrer un commentaire