https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- clang gives a much better diagnostic for sure: <source>:10:20: error: must use 'class' tag to refer to type 'foo' in this scope foo *a=new foo; ^ class <source>:2:9: note: class 'foo' is hidden by a non-type declaration of 'foo' here foo = 1 ^ <source>:10:20: error: allocation of incomplete type 'class foo' foo *a=new foo; ^~~ <source>:10:20: note: forward declaration of 'foo' <source>:10:14: error: use of undeclared identifier 'a' foo *a=new foo; ^