help with gcc 3.1 error message

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ken

    help with gcc 3.1 error message

    I cannot see how I am getting this error message:

    TreeAddress aResult( memory::Pointer (aBaseAddress) );

    if (TreeFragment * pFragment = TreeAccessor::a ccess(aResult,_ anUpdater))


    /data2/office/configmgr/source/tree/builddata.cxx: In member function
    `configmgr ::data::TreeAdd ress configmgr::data ::TreeNodeBuild er::
    allocTreeFragme nt(configmg r::memory::Upda teAccessor&)':
    /data2/office/configmgr/source/tree/builddata.cxx:6 58: error: no matching
    function for
    call to `configmgr::dat a::TreeAccessor ::access(config mgr::data::Tree Address (&)
    (configmgr::mem ory::Pointer), configmgr::memo ry::UpdateAcces sor&)'
    .../inc/treeaccessor.hx x:139: error: candidates are
    : static configmgr::shar able:: TreeFragment*
    configmgr::data ::TreeAccessor: :
    access(const configmgr::data ::TreeA ddress&,
    configmgr::memo ry::UpdateAcces sor&)
    .../inc/treeaccessor.hx x:141: error: static const configmgr::shar
    able::TreeFragm ent*
    configmgr::data ::TreeAccessor: :access(const configmgr::data :
    :TreeAddress&,
    const configmgr::memo ry::Accessor&)

  • Rob Williscroft

    #2
    Re: help with gcc 3.1 error message

    ken wrote in news:pan.2003.0 7.20.12.38.59.9 8859@gandalf.fo skey.org:
    [color=blue]
    > I cannot see how I am getting this error message:
    >
    > TreeAddress aResult( memory::Pointer (aBaseAddress) );[/color]

    The above is a function declaration ie:

    TreeAddress aResult( memory::Pointer aBaseAddress );

    change it to:

    TreeAddress aResult = memory::Pointer (aBaseAddress);

    or maybe:

    TreeAddress aResult( ( memory::Pointer (aBaseAddress) ) );

    [color=blue]
    >
    > if (TreeFragment * pFragment =
    > TreeAccessor::a ccess(aResult,_ anUpdater))
    >
    >
    > /data2/office/configmgr/source/tree/builddata.cxx: In member function
    > `configmgr ::data::TreeAdd ress configmgr::data ::TreeNodeBuild er::
    > allocTreeFragme nt(configmg r::memory::Upda teAccessor&)':
    > /data2/office/configmgr/source/tree/builddata.cxx:6 58: error: no
    > matching function for
    > call to[/color]

    This is the bit you needed to read carefully:
    [color=blue]
    > `configmgr::dat a::TreeAccessor ::access(config mgr::data::Tree Address
    > (&) (configmgr::mem ory::Pointer), configmgr::memo ry::UpdateAcces sor&)'[/color]

    Note the type of the first argument.
    [color=blue]
    > ../inc/treeaccessor.hx x:139: error: candidates are
    > : static configmgr::shar able:: TreeFragment*
    > configmgr::data ::TreeAccessor: :
    > access(const configmgr::data ::TreeA ddress&,
    > configmgr::memo ry::UpdateAcces sor&)
    > ../inc/treeaccessor.hx x:141: error: static const configmgr::shar
    > able::TreeFragm ent*
    > configmgr::data ::TreeAccessor: :access(const configmgr::data :
    > :TreeAddress&,
    > const configmgr::memo ry::Accessor&)
    >[/color]

    HTH

    Rob.
    --

    Comment

    • Michael Kochetkov

      #3
      Re: help with gcc 3.1 error message


      "Rob Williscroft" <rtw@freenet.RE MOVE.co.uk> wrote in message
      news:Xns93BE998 4B5530ukcoREMOV Efreenetrtw@195 .129.110.200...[color=blue]
      > ken wrote in news:pan.2003.0 7.20.12.38.59.9 8859@gandalf.fo skey.org:
      >[color=green]
      > > I cannot see how I am getting this error message:
      > >
      > > TreeAddress aResult( memory::Pointer (aBaseAddress) );[/color]
      >
      > The above is a function declaration ie:
      >
      > TreeAddress aResult( memory::Pointer aBaseAddress );
      >
      > change it to:
      >
      > TreeAddress aResult = memory::Pointer (aBaseAddress);
      >
      > or maybe:
      >
      > TreeAddress aResult( ( memory::Pointer (aBaseAddress) ) );[/color]
      No, it will not help. You might with to consider the proper static_cast
      instead.

      --
      With regards,
      Michael Kochetkov.


      Comment

      • ken

        #4
        Re: help with gcc 3.1 error message

        On Sun, 20 Jul 2003 19:09:01 +0400, Michael Kochetkov wrote:
        [color=blue]
        >
        > "Rob Williscroft" <rtw@freenet.RE MOVE.co.uk> wrote in message
        > news:Xns93BE998 4B5530ukcoREMOV Efreenetrtw@195 .129.110.200...[color=green]
        >> ken wrote in news:pan.2003.0 7.20.12.38.59.9 8859@gandalf.fo skey.org:
        >>[color=darkred]
        >> > I cannot see how I am getting this error message:
        >> >
        >> > TreeAddress aResult( memory::Pointer (aBaseAddress) );[/color]
        >>
        >> The above is a function declaration ie:
        >>
        >> TreeAddress aResult( memory::Pointer aBaseAddress );
        >>
        >> change it to:
        >>
        >> TreeAddress aResult = memory::Pointer (aBaseAddress);
        >>
        >> or maybe:
        >>
        >> TreeAddress aResult( ( memory::Pointer (aBaseAddress) ) );[/color]
        > No, it will not help. You might with to consider the proper static_cast
        > instead.[/color]

        Static cast was the original code. It compiled fine until 3.3.1

        TreeAddress aResult( static_cast<mem ory::Pointer>(a BaseAddress) );

        Isn't memory::Pointer (aBaseAddress) instantiating a temporary of type
        memory::Pointer , not declaring a variable ABaseAddress. The brackets
        are calling the constructor.

        I now understand how to work around this, I just don't understand what I did
        wrong.

        --
        Ta
        KenF

        Comment

        • John Harrison

          #5
          Re: help with gcc 3.1 error message


          "ken" <ken@gandalf.fo skey.org> wrote in message
          news:pan.2003.0 7.20.23.28.42.6 88129@gandalf.f oskey.org...[color=blue]
          > On Sun, 20 Jul 2003 19:09:01 +0400, Michael Kochetkov wrote:
          >[color=green]
          > >
          > > "Rob Williscroft" <rtw@freenet.RE MOVE.co.uk> wrote in message
          > > news:Xns93BE998 4B5530ukcoREMOV Efreenetrtw@195 .129.110.200...[color=darkred]
          > >> ken wrote in news:pan.2003.0 7.20.12.38.59.9 8859@gandalf.fo skey.org:
          > >>
          > >> > I cannot see how I am getting this error message:
          > >> >
          > >> > TreeAddress aResult( memory::Pointer (aBaseAddress) );
          > >>
          > >> The above is a function declaration ie:
          > >>
          > >> TreeAddress aResult( memory::Pointer aBaseAddress );
          > >>
          > >> change it to:
          > >>
          > >> TreeAddress aResult = memory::Pointer (aBaseAddress);
          > >>
          > >> or maybe:
          > >>
          > >> TreeAddress aResult( ( memory::Pointer (aBaseAddress) ) );[/color]
          > > No, it will not help. You might with to consider the proper static_cast
          > > instead.[/color]
          >
          > Static cast was the original code. It compiled fine until 3.3.1
          >
          > TreeAddress aResult( static_cast<mem ory::Pointer>(a BaseAddress) );
          >
          > Isn't memory::Pointer (aBaseAddress) instantiating a temporary of type
          > memory::Pointer , not declaring a variable ABaseAddress. The brackets
          > are calling the constructor.
          >
          > I now understand how to work around this, I just don't understand what I[/color]
          did[color=blue]
          > wrong.
          >[/color]

          No, memory::Pointer (aBaseAddress) is a parameter type, followed by a
          parameter name. The brackets are ignored. I.e.

          TreeAddress aResult( memory::Pointer (aBaseAddress) );

          is exactly the same as

          TreeAddress aResult( memory::Pointer aBaseAddress );

          which is a function prototype.

          There is a rule in C++, if something could be an expression or a
          declaration, its treated as a declaration. See the recent thread 'Temporary
          creation vs. variable declaration' for other examples.

          john


          Comment

          • Michael Kochetkov

            #6
            Re: help with gcc 3.1 error message


            "Rob Williscroft" <rtw@freenet.RE MOVE.co.uk> wrote in message
            news:Xns93BEC7D 986EE9ukcoREMOV Efreenetrtw@195 .129.110.131...[color=blue]
            > Michael Kochetkov wrote in news:3f1ab092$1 @news.trustwork s.com:
            >[color=green]
            > >
            > > "Rob Williscroft" <rtw@freenet.RE MOVE.co.uk> wrote in message
            > > news:Xns93BE998 4B5530ukcoREMOV Efreenetrtw@195 .129.110.200...[color=darkred]
            > >> ken wrote in news:pan.2003.0 7.20.12.38.59.9 8859@gandalf.fo skey.org:
            > >>
            > >> > I cannot see how I am getting this error message:
            > >> >
            > >> > TreeAddress aResult( memory::Pointer (aBaseAddress) );
            > >>
            > >> The above is a function declaration ie:
            > >>
            > >> TreeAddress aResult( memory::Pointer aBaseAddress );
            > >>
            > >> change it to:
            > >>
            > >> TreeAddress aResult = memory::Pointer (aBaseAddress);
            > >>
            > >> or maybe:
            > >>
            > >> TreeAddress aResult( ( memory::Pointer (aBaseAddress) ) );[/color]
            > > No, it will not help. You might with to consider the proper static_cast
            > > instead.
            > >[/color]
            >
            > Maybe, but if so, you and the OP have non-comforming compilers.[/color]
            Right you are. I have overlooked the opening parenthesis place (I have
            considered TreeAddress (aResult( memory::Pointer (aBaseAddress) ) ); ).
            Sorry.

            --
            With regards,
            Michael Kochetkov.


            Comment

            • ken

              #7
              Re: help with gcc 3.1 error message

              On Mon, 21 Jul 2003 07:08:31 +0100, John Harrison wrote:
              [color=blue]
              > There is a rule in C++, if something could be an expression or a
              > declaration, its treated as a declaration. See the recent thread 'Temporary
              > creation vs. variable declaration' for other examples.[/color]

              The penny drops, thanks for your help.

              --
              KenF

              Comment

              Working...