[C++0x]User-defined literals - building a call to template function.

Ed Smith-Rowland 3dw4rd@verizon.net
Wed May 4 13:12:00 GMT 2011


Greetings,

I am working on user-defined literals and have much of it working.
I am stuck on template function calls though.

If I have a literal oprator like this:

template<char... Chars>
   int
   operator"" _abc()
   { return 42 + sizeof...(Chars); }

Then later on I see this:
   int j = 123_abc;

I need to look up the function
   operator"" _abc();

I can find the function with cp_parser_lookup_name no problem.  It is 
even recognized as a template function.

I need to build the call
   operator"" _abc<'1', '2', '3'>();

My problem is I can't fill the template argument pack.
I tried tsubst and all I get is:
   operator"" _abc<>();

Any hints on how to fill the template agument list?

My patch is over on gcc-patches.

Thanks,

Ed Smith-Rowland.



More information about the Gcc mailing list