I have some trouble compiling a piece of C++ code using Clang 3.3 on linux. However the same piece of code compiles with gcc 4.8.2 as well as Intel Compiler. So I wanted if my code is actually legal. Usually I trust clang more with such questions ;)
Anyway, so here is the code fragment:
namespace test {
template<class SCALAR=double>
struct Foo {
public:
template<class SCALAR_ARG>
friend Foo<SCALAR_ARG> create_Foo( );
typedef SCALAR scalar_t;
};
template<class SCALAR_ARG=double>
Foo<SCALAR_ARG> create_Foo( )
{
typedef Foo<SCALAR_ARG> impl_t;
return impl_t();
}
}
struct Dummy {
typedef Dummy impl_t;
};
int main() {
typedef test::Foo<Dummy> foo_t;
typedef typename foo_t::scalar_t scalar_t;
Dummy egv_;
test::create_Foo();
return 0;
}
What do you think? Should I post it as bug in Clang or is it actually ill-formed?
Thanks in Advance, Raffael