There's no way to choose which "s" to print the type of here: class s { int x; } x; int s; This is related to bug 15111, but the latter refers to the inability to print the value of variable s.