[Bug c++/29266] Rule that binding rvalue to a refernce need a copy ctor don't work

yuanfei8077 at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 28 23:25:00 GMT 2006



------- Comment #2 from yuanfei8077 at gmail dot com  2006-09-28 23:25 -------
Subject: Re:  Rule that binding rvalue to a refernce need a copy ctor don't
work

Hi Andrew,

You are right, I am omitting the code, however, my question is:

1)
> t.cc:38: error: 'MemAllocator<Type>::MemAllocator() [with Type = int]' is
> private
> t.cc:49: error: within this context

However, MemAllocator is only invoked by class data member cache's
intialization list, and MemAllocator's copy constructor is already
provided, so you mean I am forced to offer default constructor too to
make it pass, right ?

2)
> There is no
> tdat_hash_map(_Alloc&) in the sources.

>::tdat_hash_map(MemAllocator<int>)main.cpp:49: note: candidates are:
tdat_hash_map<_AllocType>::tdat_hash_map() [with _AllocType =
MemAllocator<int>]
main.cpp:42: note:                 tdat_hash_map<MemAllocator<int>
>::tdat_hash_map(const tdat_hash_map<MemAllocator<int> >&)

But from the original error output, comiler have added a default
tdat_hash_map in line 42, and its format is same as what you added to
make "no matching" error disappear.  Can you explain explain why the
default can't work ?


Thanks for your help!

-Kelvin




On 28 Sep 2006 13:39:16 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-28 13:39 -------
> There is no
> tdat_hash_map(_Alloc&) in the sources.
> Adding one makes it get past that error and then we get:
> t.cc: In constructor 'tdat_hash_map<_AllocType>::tdat_hash_map(const
> _AllocType&) [with _AllocType = MemAllocator<int>]':
> t.cc:64:   instantiated from here
> t.cc:38: error: 'MemAllocator<Type>::MemAllocator() [with Type = int]' is
> private
> t.cc:49: error: within this context
>
>
> So this is invalid still.
>
>
> --
>
> pinskia at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|UNCONFIRMED                 |RESOLVED
>         Resolution|                            |INVALID
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29266
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29266



More information about the Gcc-bugs mailing list