[AST] Incorrectly qualified unscoped enumeration as template actual parameter.

An unscoped enumeration used as template argument, should not have any
qualified information about its enclosing scope, as its visibility is
global.

In the case of scoped enumerations, they must include information
about their enclosing scope.

Patch by Carlos Alberto Enciso!

Differential Revision: https://reviews.llvm.org/D39239

llvm-svn: 321312
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 2f51ec3..ee15a4d 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1548,7 +1548,10 @@
       // enumerator is declared in the scope that immediately contains
       // the enum-specifier. Each scoped enumerator is declared in the
       // scope of the enumeration.
-      if (ED->isScoped() || ED->getIdentifier())
+      // For the case of unscoped enumerator, do not include in the qualified
+      // name any information about its enum enclosing scope, as is visibility
+      // is global.
+      if (ED->isScoped())
         OS << *ED;
       else
         continue;