On 03/28/2011 08:13 PM, Ed Smith-Rowland wrote:

Please CC me on C++ questions, as I don't keep up with the mailing list very well.

I would like to check that template literal operators have the specific
non-type parameter pack:
template<char...>
Foo operator"" sluggo();

I looked through the internals documentation and didn't see much on
this. Could anyone give me some pointers?

If you're looking at the PARM_DECL for the template parameter, you want to check that TREE_TYPE (decl) is char_type_node and that TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (decl)) is true. Does that help?

Also, is there any preference for using VEC vs. TREE_CHAIN for making
trees and accessing them? Is one sort of "modern"?

VEC, definitely.

Finally I am using compparms to verify that a literal operator argument
list conforms to strings like:
(const char*)
(const char*, std::size_t)
(const wchar_t*, std::size_t)
....
I cant get them to work. I built a set of global trees for the argument
types that I want to check. The char and number tests work.
I use things like this to build the argument lists (I neglect the return
type).
userdef_lit_char16_str_type
= build_function_type_list (void_type_node, char16_array_type_node,
size_type_node, NULL_TREE);
I'm hoping that this matches
(const char16_t*, std::size_t)
but it doesn't.

Ideas?

Looks like the problem is that char16_array_type_node is an array, not a pointer.

But I'd suggest walking the parmlist directly rather than create more global trees.

Jason

Reply via email to