[Bug 1396329] Re: Rvalue reference error

Matthias Klose doko at ubuntu.com
Wed Nov 26 10:42:31 UTC 2014


g++ defaults to C++98 mode, you have to pass -stdc=c++11 explicitly.


** Changed in: gcc-defaults (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1396329

Title:
  Rvalue reference error

Status in “gcc-defaults” package in Ubuntu:
  Invalid

Bug description:
  Next simple "Hello world" :

  #include <iostream>

  using namespace std;

  class X
  {
  public:
      X (const X& lvalue)
      {
        cout << "Copy constructor" << endl;
      }
      
      X (X&& rvalue)
      {
        cout << "Move constructor" << endl;
      }
      
  };

  int main(int argc, char **argv) {
      cout << "Hello, world!" << endl;
          return 0;
  }

  
  produce next error:
  SimpleTest/main.cpp:13:9: error: expected ‘,’ or ‘...’ before ‘&&’ token
       X (X&& rvalue)
           ^
  SimpleTest/main.cpp:13:18: error: invalid constructor; you probably meant ‘X (const X&)’
       X (X&& rvalue)


  
  clang version 3.5.0-4ubuntu2    build  above code without errors.

  ProblemType: Bug
  DistroRelease: Ubuntu 14.10
  Package: g++ 4:4.9.1-4ubuntu2
  ProcVersionSignature: Ubuntu 3.16.0-25.33-generic 3.16.7
  Uname: Linux 3.16.0-25-generic x86_64
  ApportVersion: 2.14.7-0ubuntu8
  Architecture: amd64
  CurrentDesktop: LXDE
  Date: Tue Nov 25 21:42:54 2014
  InstallationDate: Installed on 2014-10-25 (31 days ago)
  InstallationMedia: Lubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
  SourcePackage: gcc-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1396329/+subscriptions



More information about the foundations-bugs mailing list