On Wed, 7 Nov 2018 22:31:20 +0100
Christian Weisgerber <na...@mips.inka.de> wrote:

> The much bigger question is how gcc6 will fare on the non-clang
> archs that would use if for all C++ ports.  In principle I agree
> that gcc4.9 is too old and a new compiler will be required for newer
> C++ code.

I have some C++ examples that give errors in gcc 4.9 on powerpc, but
work in clang on amd64.  I would try the gcc 6 diff on my PowerBook G4
running OpenBSD/macppc.  I can't try it soon, because my G4 is low of
disk space, and it needed about 18 hours to build gcc 4.9 (including
Ada and Fortran).  So I need to free some disk space, then wait for
gcc 6 to build before I can try it.

This first example shows a problem with initializer lists.
It reproduces the error from devel/vte3/patches/patch-src_app_app_cc.

=initlist.cc
struct s { double a; double b; };
extern s s1;
void f() {
        s s2{s1};
}
=end

$ eg++ -std=c++1y -c initlist.cc
initlist.cc: In function 'void f()':
initlist.cc:4:9: error: cannot convert 's' to 'double' in initialization
  s s2{s1};
         ^

This second example shows a problem with std::unique_ptr.  I got a
similar error from git master of https://github.com/SuperTux/supertux
(but not from games/supertux in ports).

=panda.cc
#include <memory>
struct bear { virtual ~bear() = default; };
struct panda: bear {};
std::unique_ptr<bear> f() {
        auto p = std::make_unique<panda>();
        return p;
}
=end

$ eg++ -std=c++1y -c panda.cc    
panda.cc: In function 'std::unique_ptr<bear> f()':
panda.cc:6:9: error: cannot bind 'std::unique_ptr<panda, 
std::default_delete<panda> >' lvalue to 'std::unique_ptr<panda, 
std::default_delete<panda> >&&'
  return p;
         ^
In file included from /usr/local/include/c++/4.9.4/memory:81:0,
                 from panda.cc:1:
/usr/local/include/c++/4.9.4/bits/unique_ptr.h:220:2: note: initializing 
argument 1 of 'std::unique_ptr<_Tp, _Dp>::unique_ptr(std::unique_ptr<_Up, 
_Ep>&&) [with _Up = panda; _Ep = std::default_delete<panda>; 
<template-parameter-2-3> = void; _Tp = bear; _Dp = std::default_delete<bear>]'
  unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
  ^

-- 
George Koehler <kern...@gmail.com>

Reply via email to