Bug 15079 - Temporary pass by reference should not need copy ctor
Summary: Temporary pass by reference should not need copy ctor
Status: RESOLVED DUPLICATE of bug 12226
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-22 21:21 UTC by David M. Lee
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux
Target: i686-pc-linux
Build: i686-pc-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David M. Lee 2004-04-22 21:21:34 UTC
The following code used to compile with gcc 3.3.  It 3.4 emits an error.

[dlee@lindb1 cpp]$ cat nocopy.cpp 
class Foo
{
  public:
    Foo(int) {}
  private:
    Foo(Foo const &);
    Foo&operator=(Foo const &);
};

void foobar(Foo const &);

int main()
{
  Foo const a(0);
  foobar(a);
  foobar(Foo(0)); // nocopy.cpp:6: error: `Foo::Foo(const Foo&)' is private
                  // nocopy.cpp:16: error: within this context
}

[dlee@lindb1 cpp]$ i686-linux-g++ nocopy.cpp -o /dev/null 
nocopy.cpp: In function `int main()':
nocopy.cpp:6: error: `Foo::Foo(const Foo&)' is private
nocopy.cpp:16: error: within this context
Comment 1 Andrew Pinski 2004-04-22 21:24:11 UTC
http://gcc.gnu.org/bugs.html#cxx_rvalbind
Comment 2 Andrew Pinski 2004-08-27 08:48:33 UTC
Reopening bug to mark as a dup of ...
Comment 3 Andrew Pinski 2004-08-27 08:48:49 UTC
bug 12226.

*** This bug has been marked as a duplicate of 12226 ***