It is not clear why the code below does not compile with GCC g ++ 4.7, saying the following:
$ g++ -std=c++11 -fPIC test.cpp test.cpp:11:45: error: 'B operator"" _b(const char*, size_t)' has invalid argument list
If class C is declared non-template, it compiles fine.
#include <cstddef> struct B{}; B operator+(B, B) { return B(); } B operator"" _b(const char *, size_t) { return B(); } template<typename T> class C { friend B operator+(B, B); friend B operator"" _b(const char *, size_t); }; int main() { return 0; }
What is wrong with this code? Or is this a compiler error?
source share