[cfe-dev] Explicit instantiation with body?
John McCall
rjmccall at apple.com
Wed Jun 19 10:43:44 PDT 2013
On Jun 19, 2013, at 9:15 AM, Larisse Voufo <lvoufo at google.com> wrote:
> Just out of curiosity, I have noticed that Clang currently allows the following program:
>
> template<typename T> T f() { return 13; }
> template int f() { return 1; }
>
> It essentially parses the body of the explicit instantiation only to ignore it.
> Was this a conscious decision?
No; please file a bug. You cannot define a function in an explicit instantiation.
> GCC 4.6.3 rejects the program with "expected ‘;’ before ‘{’ token".
Well, hopefully we can do better than that.
John.
More information about the cfe-dev
mailing list