shroud
shroud copied to clipboard
Support for variadic templates
It seems like variadic templates don't work, it would be good if the following could be used:
- decl: |
template <typename strategy, typename... Args>
Allocator makeAllocator(const std::string& name, Args... args)
cxx-template:
- instantiation: <umpire::strategy::DynamicPool, int, int>
Obviously I would expect to have to list all the arguments, but it would be nice if it worked 😄
It looks like that should work if you list the specific types in the instantiation
field.
varargs for function would be more of a problem I think. Fortran supports an OPTIONAL
attribute that could be used to support some uses of vararg. But supporting something like printf is not really possible. Are you using function varargs anywhere?
Nope, just using variadic templates. Let me give this another try - I thought I was hitting an error, but maybe I am mis-remembering.
It gives me an error:
[100%] Running shroud umpire_shroud.yaml
Traceback (most recent call last):
File "/Users/beckingsale1/Library/Python/2.7/bin/shroud", line 9, in <module>
load_entry_point('shroud==0.10.1', 'console_scripts', 'shroud')()
File "build/bdist.macosx-10.13-intel/egg/shroud/main.py", line 249, in main
File "build/bdist.macosx-10.13-intel/egg/shroud/main.py", line 398, in main_with_args
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1536, in create_library_from_dictionary
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1481, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1481, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1480, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 124, in add_declaration
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 1533, in check_decl
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 522, in decl_statement
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 704, in template_statement
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 180, in mustbe
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 185, in error_msg
RuntimeError: Parse Error
template<typename strategy, typename... Args>
Allocator makeAllocator(const std::string& name, Args... args)
^
Expected ID, found VARARG
I'm running in to another error here - I can't instantiate a template with a type that isn't a primitive data-type:
- decl: |
template <typename strategy>
Allocator makeAllocator(const std::string& name)
cxx-template:
- instantiation: <umpire::strategy::DynamicPool>
fails with:
Traceback (most recent call last):
File "/Users/beckingsale1/Library/Python/2.7/bin/shroud", line 9, in <module>
load_entry_point('shroud==0.10.1', 'console_scripts', 'shroud')()
File "build/bdist.macosx-10.13-intel/egg/shroud/main.py", line 249, in main
File "build/bdist.macosx-10.13-intel/egg/shroud/main.py", line 398, in main_with_args
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1536, in create_library_from_dictionary
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1481, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1481, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1480, in add_declarations
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 141, in add_declaration
node.col_offset = col_offset
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 201, in add_function
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1090, in __init__
File "build/bdist.macosx-10.13-intel/egg/shroud/ast.py", line 1380, in parse_instantiation
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 740, in template_argument_list
File "build/bdist.macosx-10.13-intel/egg/shroud/declast.py", line 439, in declaration_specifier
AttributeError: 'FunctionNode' object has no attribute 'unqualified_lookup'