[Rcpp-devel] gcc 10 error: symbol `fun' is already defined
iucar at fedoraproject.org
Sun Feb 9 12:14:07 CET 2020
BTW, I've noticed that, if you remove the extern "C" declaration and
compile your example as C code with gcc 9.2.1, there's a warning:
broken.c:16:16: warning: ‘f’ is static but declared in inline function
‘f2’ which is not static
16 | static void (*f)();
broken.c:9:16: warning: ‘f’ is static but declared in inline function
‘f1’ which is not static
9 | static void (*f)();
and then the linker fails with undefined references to f1 and f2.
Declaring f1 and f2 as static inline solves the issue in C and also in
C++ for gcc 10.
Maybe it would be better to declare those RcppEigen stubs as static inline?
On Sun, 9 Feb 2020 at 11:47, Iñaki Ucar <iucar at fedoraproject.org> wrote:
> On Sun, 9 Feb 2020 at 03:36, Kevin Ushey <kevinushey at gmail.com> wrote:
> > Here's an example program that fails to compile with gcc-10 for me:
> > https://gist.github.com/kevinushey/cfa848be2d39ddd110f893d9b6c5ac9c
> > So I think we can conclude this is a gcc-10 bug. It also fails with
> > the contracts branch of gcc on godbolt (although with a different
> > error):
> > https://godbolt.org/z/dowsE5
> > But gcc trunk seems okay.
> Thanks for looking into this. Now I'm more confident bringing this upstream.
More information about the Rcpp-devel