Public bug reported:

I tried to compile the following code on Ubuntu 12.04, 64-bit version
with command line "g++ -std=c++11 shared.cpp"

COMPILER OUTPUT:
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cclhuYkr.out file, please attach this to 
your bugreport.

**************************************************
shared.cpp

#include <memory>
#include <vector>

class myclass
{
        public:
        void add(std::shared_ptr<myclass> sp) { vec.push_back(sp); if(! 
sp->has(this) ) sp->add(this); }
        void add(myclass* p) { vec.push_back(std::make_shared<myclass>(p)); }

        bool has(std::shared_ptr<myclass> sp) { for(auto& x : vec) { 
if(x.lock()==sp) return true; } return false; }
        bool has(myclass* p ) { for(auto& x : vec) { if(x.lock().get() == p) 
return true; } return false; }

        std::vector<std::weak_ptr<myclass>> vec;
};

int main()
{
    return 0;
}

** Affects: gcc-4.7 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: internal pointer shared weak

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

Title:
  Internal compiler error: Error reporting routines re-entered

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to