Skip to content

Conversation

@peria
Copy link
Contributor

@peria peria commented Feb 11, 2016

This template and its specializations can be instantiated in each object file.
In such a case, we cannot link multiple object files which use toml.h.
Without inline, it depends on compilers and its optimization settings whether this templates are in-line expanded.

To help compilers to expand it and to avoid link conflicts, this CL adds inline attributes to the template.

Without inline, this template and its specializations are
instantiated in each object file. In this case, we cannot
link multiple object files which use toml.h.

To avoid this conflict, this CL inlines the template.
@mayah
Copy link
Owner

mayah commented Feb 11, 2016

Oops. Thanks for the quick fix!

mayah added a commit that referenced this pull request Feb 11, 2016
Inline internal::type_name<> templates.
@mayah mayah merged commit ce9ce71 into mayah:master Feb 11, 2016
@peria
Copy link
Contributor Author

peria commented Feb 11, 2016

It is difficult to make a test to verify this situation in a reliable way, but you can check it as follows.

  1. Add a file empty.cc which just includes toml.h under src/
  2. Compile it with src/parse_stdin.cc. I confirmed it with VC++14 (2015)
> cl src/parse_stdin.cc src/empty.cc /Iinclude

@mayah
Copy link
Owner

mayah commented Feb 11, 2016

I'll write a link test to prevent this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants