Created
March 29, 2016 18:41
-
-
Save dcci/e69cad69179e23069267f4f986be0975 to your computer and use it in GitHub Desktop.
gcc struct/classes
This file contains 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
[davide@localhost bin]$ g++ blah.cpp -o blah | |
blah.cpp: In function ‘int main()’: | |
blah.cpp:10:9: error: ‘union’ tag used in naming ‘struct G<int>’ [-fpermissive] | |
union G<int> foo; | |
^ | |
blah.cpp:4:7: note: ‘struct G<int>’ was previously declared here | |
class G { | |
^ | |
[davide@localhost bin]$ cat blah.cpp | |
#include <stdio.h> | |
template <typename T> | |
class G { | |
public: | |
G<T>() { puts("blah"); } | |
}; | |
int main() { | |
union G<int> foo; | |
return (0); | |
} | |
[davide@localhost bin]$ g++ --version | |
g++ (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2) | |
Copyright (C) 2015 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment