Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/underlying_type.cpp b/test/SemaCXX/underlying_type.cpp
index 0e43100..607d9ad 100644
--- a/test/SemaCXX/underlying_type.cpp
+++ b/test/SemaCXX/underlying_type.cpp
@@ -25,3 +25,13 @@
 __underlying_type(f) h;
 static_assert(is_same_type<char, decltype(h)>::value,
               "h has the wrong type");
+
+template <typename T>
+struct underlying_type {
+  typedef __underlying_type(T) type; // expected-error {{only enumeration types}}
+};
+
+static_assert(is_same_type<underlying_type<f>::type, char>::value,
+              "f has the wrong underlying type in the template");
+
+underlying_type<int>::type e; // expected-note {{requested here}}