+2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (grokfndecl): Use the location_t argument in two more places.
+
2018-06-06 Marek Polacek <polacek@redhat.com>
PR c++/85977
if (friendp && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{
if (funcdef_flag)
- error ("defining explicit specialization %qD in friend declaration",
- orig_declarator);
+ error_at (location,
+ "defining explicit specialization %qD in friend declaration",
+ orig_declarator);
else
{
tree fns = TREE_OPERAND (orig_declarator, 0);
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Something like `template <class T> friend void f<T>()'. */
- error ("invalid use of template-id %qD in declaration "
- "of primary template",
- orig_declarator);
+ error_at (location,
+ "invalid use of template-id %qD in declaration "
+ "of primary template",
+ orig_declarator);
return NULL_TREE;
}
+2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/template/friend64.C: New.
+ * g++.old-deja/g++.other/friend4.C: Test the location too.
+ * g++.old-deja/g++.pt/crash23.C: Likewise.
+
2018-06-10 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.dg/inline_matmul_23.f90: New test.
--- /dev/null
+template <class T> void foo (int);
+
+template <class T>
+class Q {
+ friend void foo<T> (int) { } // { dg-error "15:defining explicit specialization" }
+};
template <class A, class B> void foo();
template <class C> class bar {
int i; // { dg-message "" } private
- template <class B> friend void foo<C,B>(); // { dg-error "" } bogus declaration
+ template <class B> friend void foo<C,B>(); // { dg-error "34:invalid use of template-id" }
};
template <class A, class B> void foo() {
bar<A> baz; baz.i = 1; // { dg-error "" } foo cannot access bar<int>::i
template <class C> class bar {
public:
int i;
- template <class B> friend void foo<C,B>(); // { dg-error "" } template-id
+ template <class B> friend void foo<C,B>(); // { dg-error "34:invalid use of template-id" }
};
template <class A, class B> void foo() {
bar<A> baz; baz.i = 1;