[Bug c++/87947] Symbol Does Not Appear in Object File

2018-11-26 Thread comm+gnu at squotd dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87947

--- Comment #5 from comm+gnu at squotd dot net ---
OK, thanks. I appreciate the explanation.

[Bug c++/87947] Symbol Does Not Appear in Object File

2018-11-26 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87947

--- Comment #4 from Jonathan Wakely  ---
That answer is about whether it's "safe", and explains that the -std options do
not create ABI incompatibilities. The question is also stated as (emphasis in
the original):

> For simplicity, let's assume all headers were written in C++11, **using only 
> constructs whose semantics haven't changed between all three standard 
> versions**.

This is a feature whose semantics changed. What you're seeing is pretty much
required behaviour for a correct implementation, not an ABI incompatibility
introduced by GCC.

[Bug c++/87947] Symbol Does Not Appear in Object File

2018-11-25 Thread comm+gnu at squotd dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87947

--- Comment #3 from comm+gnu at squotd dot net ---
Does this result in an exception to the answer you gave here about gcc being
able to link c++14 and c++17 object files together? (Or am I missing
something?)

https://stackoverflow.com/questions/46746878/is-it-safe-to-link-c17-c14-and-c11-objects?answertab=active#tab-top

[Bug c++/87947] Symbol Does Not Appear in Object File

2018-11-09 Thread comm+gnu at squotd dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87947

--- Comment #2 from comm+gnu at squotd dot net ---
Thanks. I had no idea that had changed.

[Bug c++/87947] Symbol Does Not Appear in Object File

2018-11-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87947

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Jonathan Wakely  ---
(In reply to comm+gnu from comment #0)
> The expected behavior is that A::foobar is exposed as a symbol. Note that
> -std=c++17 is required to duplicate this.

Your expectation is wrong. In C++17 the static data member is implicitly
"inline" which means a definition is only emitted when it's odr-used (and the
namespace scope definition is redundant, and deprecated).

GCC 6.x does not implement the C++17 rule, so still emits the symbol.

If you need to ensure a definition is emitted in a given object file either
compile it as C++14, or mark it as used:

[[gnu::used]] constexpr int A::foobar;