-
Notifications
You must be signed in to change notification settings - Fork 325
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
Compile error with GCC #538
Comments
I confirm that this is a bug in GCC. A testcase fails with GCC and succeeds with Clang (checked by testing in https://gcc.godbolt.org/ ) |
Thanks for the heads up. (GCC may be following the standard, and Clang and MSVC are missing this one. Or, it may very well be a bug in GCC...) There's a bug for this in GCC's bug tracker. It looks like it was opened by @ramon-garcia. |
Sure, I'll take a look. |
Here is a shorter repro: template <typename P, typename T>
void foo()
{
struct X
{
void bar()
{
this->var.template X<P>();
}
T var;
};
} I'm not sure which compiler is correct (will need to contact some C++ language lawyer 😃), but this can be resolved by adding this->var.T::template X<P>(); Renaming the |
@chwarr Yes, I posted the bug in GCC bug tracker. I couldn't figure out that the name clash between Deserialize struct and Deserialize method is the cause. In this case, renaming the struct is safe solution. Please consider this fix. Even if GCC is wrong, it is the mainstream compiler in Linux. It would take years until new releases include GCC 8 with this bug fixed. |
@ramon-garcia, agreed. Let me put together a PR. |
Deserialize was used as the name for both a struct and a member function. This causes some versions of G++ to emit errors, so rename the helper struct. Fixes microsoft#538
* Deserialize was used as the name for both a struct and a member function. This causes some versions of G++ to emit errors, so rename the helper struct. Fixes microsoft#538 * The Protocols template argument could not be deduced in one place where bond::SelectProtocolAndApply was called. It is now explicitly specified.
* Deserialize was used as the name for both a struct and a member function. This causes some versions of G++ to emit errors, so rename the helper struct. Fixes #538 * The Protocols template argument could not be deduced in one place where bond::SelectProtocolAndApply was called. It is now explicitly specified.
While building the master version with GCC, the following error appeared:
In file included from /devel/bond/cpp/inc/bond/core/parser.h:8:0, from /devel/bond/cpp/inc/bond/core/apply.h:9, from /devel/bond/cpp/inc/bond/core/bond.h:7, from /devel/bond/build/cpp/bond/core/bond_apply.h:16, from /devel/bond/build/cpp/bond/core/bond_apply.cpp:13: /devel/bond/cpp/inc/bond/core/value.h: In member function ‘void bond::DeserializeElement(X&, const I&, const T&)::Deserialize::operator()(typename bond::element_type<T>::type&)’: /devel/bond/cpp/inc/bond/core/value.h:644:57: error: non-template type ‘Deserialize’ used as a template this->element.template Deserialize<Protocols>(e); ^
This looks like a limitation of GCC, though I tested it with GCC 4.9, 6.3.0 and 7.1
Attached a workaround.
fix_gcc_core_value.diff.txt
The text was updated successfully, but these errors were encountered: