Skip to content

Instantly share code, notes, and snippets.

@dcci
Created March 29, 2016 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcci/e69cad69179e23069267f4f986be0975 to your computer and use it in GitHub Desktop.
Save dcci/e69cad69179e23069267f4f986be0975 to your computer and use it in GitHub Desktop.
gcc struct/classes
[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