[GCC-XML] Default parameter values in member functions of templated classes.
Bryan Ischo
bji-gccxml at ischo.com
Tue Feb 26 01:27:41 EST 2008
Brad King wrote:
> I think what happens is that GCC's expression-to-string conversion is
> designed to be used during error message construction. GCC error
> messages look like this:
>
> error: initializing argument 1 of ‘std::basic_string<_CharT,
> _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with
> _CharT = char, _Traits = std::char_traits<char>, _Alloc =
> std::allocator<char>]’
>
> (the code tried to construct std::string(1) which is an error). Note
> that the prototype is given with the template formal parameters
> instead of the actual arguments. Then the rest of the message maps
> the parameters to their values. GCC-XML is using the same
> expression-to-string functionality from GCC. This is not the only
> limitation of the expression-to-string conversion that people have
> encountered. In general I think the "default" attribute is useful
> mostly for human reference.
Can you elaborate on the other limits in the expression-to-string
conversion that people have encountered? It would help me to know about
these things instead of discovering them later on myself.
As to the utility of correct default attributes - I had wanted to use
the text in the default attribute directly in generated C++ code, but it
wasn't working for defaults like the problematic one I wrote about. So
I scrapped that, and instead just give the user the text string of the
default value to do with what they will. It's just for completeness of
my API (the xrtti "extended runtime typing for C++" system) that I want
to be able to provide programmatic representations of the defaults to
the API users, not because I have any particular use case in which valid
default values would be useful. Perhaps I should submit a feature
request in the gccxml bug database for better expression-to-string
handling, especially with regards to default values?
Thanks,
Bryan
More information about the gccxml
mailing list