-
Notifications
You must be signed in to change notification settings - Fork 268
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
BUG: fix a bug for clang. #9
Conversation
Const type without a user-provided default constructor. https://stackoverflow.com/questions/26077807/why-does-gcc-allow-a-const-object-without-a-user-declared-default-constructor-bu
@JianCheng What version of Clang are you using and what were the compiler options used to generate the error you're seeing? |
Hi @ArashPartow . I am using clang 3.7.0 in fedora 23.
it shows
|
@JianCheng I was not able to reproduce the error, using the most recent clang:
Building for C++11, C++14 and C++17:
|
Maybe the newer version of clang fixed it.
|
@JianCheng Note that the 'type' class is an empty type. The issue of an uninitialized const instance occurs when a class that has members is being instantiated and no constructor is provided - the question becomes what use is such as class as it's members are not initialized and will hence possibly cause UB when used, and it is const so there is no way to modify/initialise the members after construction. That being said, I've now retested it with Clang 4.7, GCC 4.8 - 7.1, MSVC 10-14 and they all compile error and warning free. |
@JianCheng I've made changes to ExprTk that should now allow for older versions of Clang to build error and warning free. In short the problem seems to be related to DR-253. In the given context an error should be thrown iff the class/struct has members, otherwise if it is empty (by design for compile-time tag dispatch purposes) the compiler should not raise that particular diagnostic (either warning or error). If possible, give the most recent version a go and if you find any issues do let me know. |
There is a bug when building exprtk with clang.
Const type without a user-provided default constructor.
https://stackoverflow.com/questions/26077807/why-does-gcc-allow-a-const-object-without-a-user-declared-default-constructor-bu