Implement semantic checking for template arguments that correspond to
pointer-to-member-data non-type template parameters. Also, get
consistent about what it means to returned a bool from
CheckTemplateArgument.

llvm-svn: 64305
diff --git a/clang/test/SemaTemplate/temp_arg.cpp b/clang/test/SemaTemplate/temp_arg.cpp
index d62f681..0f69b5f 100644
--- a/clang/test/SemaTemplate/temp_arg.cpp
+++ b/clang/test/SemaTemplate/temp_arg.cpp
@@ -8,6 +8,7 @@
 
 A<int, 0, X> * a1;
 
-A<float, 1, X, double> *a2; // expected-error{{too many template arguments for class template 'A'}}
-
-A<float, 1> *a3; // expected-error{{too few template arguments for class template 'A'}}
+A<float, 1, X, double> *a2; // expected-error{{too many template arguments for class template 'A'}} \
+          // expected-error{{unqualified-id}}
+A<float, 1> *a3; // expected-error{{too few template arguments for class template 'A'}} \
+          // expected-error{{unqualified-id}}
diff --git a/clang/test/SemaTemplate/temp_arg_nontype.cpp b/clang/test/SemaTemplate/temp_arg_nontype.cpp
index f069acc..63cfa8f 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -3,9 +3,11 @@
 
 A<0> *a0;
 
-A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int (void)'}}
+A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int (void)'}} \
+              // FIXME: expected-error{{unqualified-id}}
 
-A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}}
+A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}} \
+              // FIXME: expected-error{{unqualified-id}}
 
 A<1 >> 2> *a3;
 
@@ -15,8 +17,8 @@
           // FIXME: expected-error{{expected unqualified-id}}
 
 enum E { Enumerator = 17 };
-A<E> *a5; // expected-error{{template argument for non-type template parameter must be an expression}}
-
+A<E> *a5; // expected-error{{template argument for non-type template parameter must be an expression}} \
+          // FIXME: expected-error{{unqualified-id}}
 template<E Value> struct A1; // expected-note{{template parameter is declared here}}
 A1<Enumerator> *a6; // okay
 A1<17> *a7; // expected-error{{non-type template argument of type 'int' cannot be converted to a value of type 'enum E'}} \
@@ -96,9 +98,20 @@
   float bar(float);
   int bar(int);
   double baz(double);
+
+  int int_member;
+  float float_member;
 };
 template<int (Z::*pmf)(int)> struct A6; // expected-note{{template parameter is declared here}}
 A6<&Z::foo> *a17_1;
 A6<&Z::bar> *a17_2;
 A6<&Z::baz> *a17_3; // expected-error{{non-type template argument of type 'double (struct Z::*)(double)' cannot be converted to a value of type 'int (struct Z::*)(int)'}} \
 // FIXME: expected-error{{expected unqualified-id}}
+
+
+template<int Z::*pm> struct A7;  // expected-note{{template parameter is declared here}}
+template<int Z::*pm> struct A7c;
+A7<&Z::int_member> *a18_1;
+A7c<&Z::int_member> *a18_2;
+A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float struct Z::*' cannot be converted to a value of type 'int struct Z::*'}} \
+              // FIXME: expected-error{{unqualified-id}}
diff --git a/clang/test/SemaTemplate/temp_arg_template.cpp b/clang/test/SemaTemplate/temp_arg_template.cpp
index 3e8e6f2..e1b9bb4 100644
--- a/clang/test/SemaTemplate/temp_arg_template.cpp
+++ b/clang/test/SemaTemplate/temp_arg_template.cpp
@@ -35,7 +35,8 @@
 // FIXME: we're right to provide an error message, but it should say
 // that we need a class template. We won't get this right until name
 // lookup of 'f' returns a TemplateDecl.
-A<f> *a9; // expected-error{{template argument for template template parameter must be a template}}
+A<f> *a9; // expected-error{{template argument for template template parameter must be a template}} \
+          // expected-error{{unqualified-id}}
 
 // FIXME: The code below is ill-formed, because of the evil digraph '<:'. 
 // We should provide a much better error message than we currently do.
diff --git a/clang/test/SemaTemplate/temp_arg_type.cpp b/clang/test/SemaTemplate/temp_arg_type.cpp
index c755362..36764fc 100644
--- a/clang/test/SemaTemplate/temp_arg_type.cpp
+++ b/clang/test/SemaTemplate/temp_arg_type.cpp
@@ -2,9 +2,11 @@
 template<typename T> class A; // expected-note 2 {{template parameter is declared here}}
 
 // [temp.arg.type]p1
-A<0> *a1; // expected-error{{template argument for template type parameter must be a type}}
+A<0> *a1; // expected-error{{template argument for template type parameter must be a type}} \
+          // expected-error{{unqualified-id}}
 
-A<A> *a2; // expected-error{{template argument for template type parameter must be a type}}
+A<A> *a2; // expected-error{{template argument for template type parameter must be a type}} \
+          // expected-error{{unqualified-id}}
 
 A<int> *a3;
 A<int()> *a4;