-
-
Save detunized/8007873 to your computer and use it in GitHub Desktop.
Strange compile error Clang vs GCC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ clang -c test.cpp; gcc -c test.cpp | |
test.cpp:10:7: error: read-only variable is not assignable | |
x = 0; | |
~ ^ | |
test.cpp:26:7: note: in instantiation of member function 'A<float>::f' requested here | |
a.f(0); | |
^ | |
1 error generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
struct A | |
{ | |
void f(const int); | |
}; | |
template <typename T> | |
void A<T>::f(int x) | |
{ | |
x = 0; | |
} | |
struct B | |
{ | |
void f(const int); | |
}; | |
void B::f(int x) | |
{ | |
x = 0; | |
} | |
void f() | |
{ | |
A<float> a; | |
a.f(0); | |
B b; | |
b.f(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment