Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline static std::string name = "std::string"; in the documentation suggests the alias is modifiable at run time #15

Open
frederick-vs-ja opened this issue Jun 19, 2024 · 0 comments

Comments

@frederick-vs-ja
Copy link

frederick-vs-ja commented Jun 19, 2024

Not sure whether this is intended. And this isn't consistent with the implementation in customization.h.

magic-cpp/README.md

Lines 42 to 48 in 8d352d7

```cpp
template<>
struct magic::type_info<std::string>
{
inline static std::string name = "std::string";
};
```

template <>
struct magic::type_info<std::string>
{
constexpr static const char* name = "std::string";
};


Also, the use of such a pointer is possibly (but not always) IFNDR because magic::type_info<std::string>::name can be initialized to different values in multiple TUs when the string literal is not merged, see CWG2678.

How about changing the specialization(s) like this?

template <>
struct magic::type_info<std::string>
{
    constexpr static char name[]{"std::string"};
};
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

No branches or pull requests

1 participant