ptal / expected

What did you expect?
113 stars 18 forks source link

MSVC2013: linker error LNK2005 - "only_set_valid" already defined #81

Closed hia3 closed 9 years ago

hia3 commented 9 years ago

I've included boost/expected/expected.hpp in 2 translation units and got an error:

error LNK2005: "struct boost::detail::only_set_valid_t boost::detail::only_set_valid" (?only_set_valid@detail@boost@@3Uonly_set_valid_t@12@A)

This is because there is no constexpr support in MSVC2013.

Adding __declspec(selectany) before only_set_valid fixes this linker error (but I'm not sure if it works).

viboes commented 9 years ago

You could replace the line by

struct only_set_valid_t{};

as for the time being only_set_valid it is not used.

viboes commented 9 years ago

https://github.com/ptal/expected/commit/6d0274dc50047e4da4a152296a5cb5552c46d97c