https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61687
Bug ID: 61687 Summary: [4.10 regression] -O PASS, -O2 report error Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimhen at gmail dot com r212098 PASS r212191 FAIL r212258 FAIL $ ~/bin/gcc_212191_wo_fold/bin/g++ -c -fpreprocessed -O n.ii $ ~/bin/gcc_212191_wo_fold/bin/g++ -c -fpreprocessed -O2 n.ii n.ii: In destructor 'virtual G::~G()': n.ii:11:11: error: 'D::~D()' is private virtual ~D(); ^ n.ii:16:7: error: within this context class G : D { ^ n.ii: At global scope: n.ii:18:2: note: synthesized method 'virtual G::~G()' first required here }; ^ n.ii: In instantiation of 'B< <template-parameter-1-1> >::~B() [with <template-parameter-1-1> = int]': n.ii:13:7: required from here n.ii:6:36: error: invalid use of incomplete type 'class A' ~B() { _M_impl._M_end_of_storage - 0; } ^ n.ii:1:7: note: forward declaration of 'class A' class A; ^ $ cat n.ii class A; template <typename> struct B { struct C { A *_M_end_of_storage; }; ~B() { _M_impl._M_end_of_storage - 0; } C _M_impl; }; class D { virtual ~D(); }; class F { B<int> m_value; }; class G : D { F NPCadesImpl; }; $ ~/bin/gcc_212191_wo_fold/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/dimhen/bin/gcc_212191_wo_fold/bin/g++ COLLECT_LTO_WRAPPER=/home/dimhen/bin/gcc_212191_wo_fold/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current/ --enable-checking=yes,df,rtl,tree --enable-languages=c,c++,lto --enable-plugin --enable-version-specific-runtime-libs --enable-static Thread model: posix gcc version 4.10.0 20140701 (experimental) [trunk revision 212191] (GCC)