gcc 4.9.3: typedef referenced in a friend template function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

gcc 4.9 complains on the following line marked <<<

        template<typename stream, int size>
DTT_API_SCOPE stream& operator<<(stream& os, const Alphabetic<size>& a) { os << static_cast<const Alphabetic<size>::DataType&>(a); // <<<
            return os;
        }

with this error
/cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:28: attention : ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
    os << static_cast<const Alphabetic<size>::DataType&>(a);


What is the meaning of: ISO C++ forbids declaration of ‘type name’ with no type?

1/Here an snippet of Alphabetic

        template<int sizeb>
        class DTT_API_SCOPE Alphabetic : public Bytes < sizeb, ' ' > {
        public:
            typedef Bytes <sizeb, ' ' > DataType;

        public:

            template<typename stream, int size>
friend DTT_API_SCOPE stream& operator>>(stream& is, Alphabetic<size>& a);
            template<typename stream, int size>
friend DTT_API_SCOPE stream& operator<<(stream& os, const Alphabetic<size>& a);
           };

Below the log:

g++ -O0 -g3 -std=c++11 -Wno-non-template-friend -Wno-cpp -fmessage-length=0 -fpermissive -D_GLIBCXX_USE_C99 -DVRM_ISO_8583=1987 -D_DEBUG -I/cygdrive/z/git/ISO-8583/cpp/inc -I"/cygdrive/z/git/pocozos" -I"/cygdrive/z/git/pocozos/NetSSL_Win/include" -I"/cygdrive/z/git/pocozos/Net/include" -I"/cygdrive/z/git/pocozos/XML/include" -I"/cygdrive/z/git/pocozos/Util/include" -I"/cygdrive/z/git/pocozos/Foundation/include" -I"/cygdrive/z/git/pocozos/CppUnit/include" -c -o /cygdrive/z/git/ISO-8583/cpp/make/obj/Cygwin/i686/ISO-8583/DTT/Alphabetic.o -MMD -MP -MF"/cygdrive/z/git/ISO-8583/cpp/make/obj/Cygwin/i686/ISO-8583/DTT/Alphabetic.d" /cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp /cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp: In function ‘stream& ISO_8583::DTT::operator<<(stream&, const ISO_8583::DTT::Alphabetic<size>&)’: /cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:28: attention : ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
    os << static_cast<const Alphabetic<size>::DataType&>(a);
                            ^
/cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:28: erreur: expected ‘>’ /cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:28: erreur: expected ‘(’ /cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:55: erreur: expected primary-expression before ‘>’ token
    os << static_cast<const Alphabetic<size>::DataType&>(a);
                                                       ^
/cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp:74:59: erreur: expected ‘)’ before ‘;’ token
    os << static_cast<const Alphabetic<size>::DataType&>(a);
                                                           ^
/cygdrive/z/git/ISO-8583/cpp/code/ISO-8583/DTT/Alphabetic.cpp: In instantiation of ‘stream& ISO_8583::DTT::operator<<(stream&, const ISO_8583::DTT::Alphabetic<size>&) [with stream = ISO_8583::DTT::BinaryOutputStream; int size = 2]’:


$ gcc -v
Utilisation des specs internes.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.9.3/lto-wrapper.exe
Target: i686-pc-cygwin
Configuré avec: /cygdrive/i/szsz/tmpp/gcc/gcc-4.9.3-1.i686/src/gcc-4.9.3/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.3-1.i686/src/gcc-4.9.3 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Modèle de thread: posix
gcc version 4.9.3 (GCC)




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux