Hi again,
I am having issues with the __comp_ctor () __base_ctor () etc functions
that I encounter in the C++ front-end tree (Just before gimplification).
If i compile some code that looks like:
#include <string>
int main()
{
std::allocator<char> alloc;
const char* str1 = "Hello";
const char* str2 = "Hello";
std::basic_string<char, std::char_traits<char>, std::allocator<char>
> str(str1, str2, alloc);
return 0;
}
Note: I think this code is incorrect, however it compiles fine.
I am trying to figure out which of the constructors of std::basic_string
GCC would use for this code. Is it the following constructor?
template<class _InputIterator>
basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc&
__a = _Alloc());
The main problem i am having is that GCC generates a FUNCTION_DECL for:
__comp_ctor (::char const*, ::char const*, ::std::allocator<char> const&)
I am trying to find the corresponding constructor from the basic_string
class that should be called in place of the __comp_ctor function. There
seems to be no FUNCTION_DECL node for the constructor:
basic_string(::char const*, ::char const*, ::std::allocator<char> const&)
which I would expect if there is a __comp_ctor () with those parameters.
My questions are:
1) Which of the basic_string constructors would be being called in this
situation?
2) Do __comp_ctor and __base_ctor functions just call/are substituted
with equivilant "User Constructors" with exactly the same arguments or
do the arguments of the __comp_ctor sometimes differ from the "User
Constructor" that it is associated with?
3) Again, is there a simple way of finding the constructor method that
would be called given a corresponding __comp_ctor () method?
Thanks,
Brendon.