aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-06-30 14:50:48 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-06-30 14:50:48 +0000
commitfe32bb1b5bd2973305a206a29ed4c7c8749d98c5 (patch)
treefc79ce537be5fa1789fba27c6c91096f4669ec07 /gcc
parent367e91e1c5c293da8d0999cb2bc5d8cd2c95e6b4 (diff)
downloadgcc-fe32bb1b5bd2973305a206a29ed4c7c8749d98c5.zip
gcc-fe32bb1b5bd2973305a206a29ed4c7c8749d98c5.tar.gz
gcc-fe32bb1b5bd2973305a206a29ed4c7c8749d98c5.tar.bz2
cp-tree.h (lookup_fnfields_1, [...]): Don't declare.
* cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't declare. (lookup_all_conversions): Declare. * class.c (get_basefndecls): Use lookup_fnfields_slot. * decl.c (register_dtor_fn): Use lookup_fnfields_slot. * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework diagnostics. * pt.c (retrieve_specialization): Use lookup_fnfields_slot. (check_explicit_specialization): Use lookup_fnfields_slot_nolazy, lookup_all_conversions. * search.c (lookup_fnfields_1): Make static. (lookup_all_conversions): New. (class_method_index_for_fn): Delete. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use lookup_fnfields_slot. * g++.dg/concepts/memfun-err.C: Adjust diagnostics. * g++.dg/cpp0x/decltype9.C: Likewise. * g++.dg/cpp0x/forw_enum9.C: Likewise. * g++.dg/lookup/decl1.C: Likewise. * g++.dg/lookup/extern-c-redecl.C: Likewise. * g++.dg/other/pr28432.C: Likewise. * g++.dg/parse/crash12.C: Likewise. * g++.dg/parse/enum3.C: Likewise. * g++.dg/parse/operator6.C: Likewise. * g++.dg/template/crash69.C: Likewise. * g++.dg/template/error27.C: Likewise. * g++.dg/template/error28.C: Likewise. * g++.dg/template/memfriend6.C: Likewise. * g++.old-deja/g++.mike/err1.C: Likewise. * g++.old-deja/g++.mike/p811.C: Likewise. * g++.old-deja/g++.other/crash25.C: Likewise. * g++.old-deja/g++.other/dtor4.C: Likewise. * g++.old-deja/g++.pt/t37.C: Likewise. From-SVN: r249843
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/class.c28
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c177
-rw-r--r--gcc/cp/pt.c56
-rw-r--r--gcc/cp/search.c28
-rw-r--r--gcc/cp/semantics.c6
-rw-r--r--gcc/testsuite/ChangeLog21
-rw-r--r--gcc/testsuite/g++.dg/concepts/memfun-err.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype9.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/forw_enum9.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/decl1.C13
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-c-redecl.C2
-rw-r--r--gcc/testsuite/g++.dg/other/pr28432.C6
-rw-r--r--gcc/testsuite/g++.dg/parse/crash12.C9
-rw-r--r--gcc/testsuite/g++.dg/parse/enum3.C6
-rw-r--r--gcc/testsuite/g++.dg/parse/operator6.C5
-rw-r--r--gcc/testsuite/g++.dg/template/crash69.C5
-rw-r--r--gcc/testsuite/g++.dg/template/error27.C5
-rw-r--r--gcc/testsuite/g++.dg/template/error28.C5
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend6.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/err1.C6
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p811.C11
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/crash25.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/dtor4.C12
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/t37.C9
27 files changed, 234 insertions, 239 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c54cb24..4260bbf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,21 @@
2017-06-30 Nathan Sidwell <nathan@acm.org>
+ * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
+ declare.
+ (lookup_all_conversions): Declare.
+ * class.c (get_basefndecls): Use lookup_fnfields_slot.
+ * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
+ * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
+ diagnostics.
+ * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
+ (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
+ lookup_all_conversions.
+ * search.c (lookup_fnfields_1): Make static.
+ (lookup_all_conversions): New.
+ (class_method_index_for_fn): Delete.
+ * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
+ lookup_fnfields_slot.
+
* call.c (build_new_method_call_1): Use constructo_name to get
ctor name. Move argument processing earlier to merge cdtor
handling blocks.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 09633b8..0dca905 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2966,29 +2966,25 @@ modify_all_vtables (tree t, tree virtuals)
static void
get_basefndecls (tree name, tree t, vec<tree> *base_fndecls)
{
- int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
- int i;
+ bool found_decls = false;
/* Find virtual functions in T with the indicated NAME. */
- i = lookup_fnfields_1 (t, name);
- bool found_decls = false;
- if (i != -1)
- for (ovl_iterator iter ((*CLASSTYPE_METHOD_VEC (t))[i]); iter; ++iter)
- {
- tree method = *iter;
+ for (ovl_iterator iter (lookup_fnfields_slot (t, name)); iter; ++iter)
+ {
+ tree method = *iter;
- if (TREE_CODE (method) == FUNCTION_DECL
- && DECL_VINDEX (method))
- {
- base_fndecls->safe_push (method);
- found_decls = true;
- }
- }
+ if (TREE_CODE (method) == FUNCTION_DECL && DECL_VINDEX (method))
+ {
+ base_fndecls->safe_push (method);
+ found_decls = true;
+ }
+ }
if (found_decls)
return;
- for (i = 0; i < n_baseclasses; i++)
+ int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
+ for (int i = 0; i < n_baseclasses; i++)
{
tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), i));
get_basefndecls (name, basetype, base_fndecls);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b3cff08..4b5ff69 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6567,10 +6567,9 @@ extern int accessible_p (tree, tree, bool);
extern int accessible_in_template_p (tree, tree);
extern tree lookup_field_1 (tree, tree, bool);
extern tree lookup_field (tree, tree, int, bool);
-extern int lookup_fnfields_1 (tree, tree);
extern tree lookup_fnfields_slot (tree, tree);
extern tree lookup_fnfields_slot_nolazy (tree, tree);
-extern int class_method_index_for_fn (tree, tree);
+extern tree lookup_all_conversions (tree);
extern tree lookup_fnfields (tree, tree, int);
extern tree lookup_member (tree, tree, int, bool,
tsubst_flags_t,
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index abb6cc4..62877dc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7849,12 +7849,8 @@ register_dtor_fn (tree decl)
use_dtor = ob_parm && CLASS_TYPE_P (type);
if (use_dtor)
{
- int idx;
+ cleanup = lookup_fnfields_slot (type, complete_dtor_identifier);
- /* Find the destructor. */
- idx = lookup_fnfields_1 (type, complete_dtor_identifier);
- gcc_assert (idx >= 0);
- cleanup = (*CLASSTYPE_METHOD_VEC (type))[idx];
/* Make sure it is accessible. */
perform_or_defer_access_check (TYPE_BINFO (type), cleanup, cleanup,
tf_warning_or_error);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 08f122d..877745c 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -558,10 +558,6 @@ check_member_template (tree tmpl)
tree
check_classfn (tree ctype, tree function, tree template_parms)
{
- int ix;
- bool is_template;
- tree pushed_scope;
-
if (DECL_USE_TEMPLATE (function)
&& !(TREE_CODE (function) == TEMPLATE_DECL
&& DECL_TEMPLATE_SPECIALIZATION (function))
@@ -594,7 +590,7 @@ check_classfn (tree ctype, tree function, tree template_parms)
}
/* OK, is this a definition of a member template? */
- is_template = (template_parms != NULL_TREE);
+ bool is_template = (template_parms != NULL_TREE);
/* [temp.mem]
@@ -608,111 +604,88 @@ check_classfn (tree ctype, tree function, tree template_parms)
/* We must enter the scope here, because conversion operators are
named by target type, and type equivalence relies on typenames
resolving within the scope of CTYPE. */
- pushed_scope = push_scope (ctype);
- ix = class_method_index_for_fn (complete_type (ctype), function);
- if (ix >= 0)
- {
- vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (ctype);
-
- for (ovl_iterator iter ((*methods)[ix]); iter; ++iter)
- {
- tree fndecl = *iter;
- tree p1 = TYPE_ARG_TYPES (TREE_TYPE (function));
- tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
-
- /* We cannot simply call decls_match because this doesn't
- work for static member functions that are pretending to
- be methods, and because the name may have been changed by
- asm("new_name"). */
-
- /* Get rid of the this parameter on functions that become
- static. */
- if (DECL_STATIC_FUNCTION_P (fndecl)
- && TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
- p1 = TREE_CHAIN (p1);
-
- /* A member template definition only matches a member template
- declaration. */
- if (is_template != (TREE_CODE (fndecl) == TEMPLATE_DECL))
- continue;
-
- /* ref-qualifier or absence of same must match. */
- if (type_memfn_rqual (TREE_TYPE (function))
- != type_memfn_rqual (TREE_TYPE (fndecl)))
- continue;
-
- // Include constraints in the match.
- tree c1 = get_constraints (function);
- tree c2 = get_constraints (fndecl);
-
- /* While finding a match, same types and params are not enough
- if the function is versioned. Also check version ("target")
- attributes. */
- if (same_type_p (TREE_TYPE (TREE_TYPE (function)),
- TREE_TYPE (TREE_TYPE (fndecl)))
- && compparms (p1, p2)
- && !targetm.target_option.function_versions (function, fndecl)
- && (!is_template
- || comp_template_parms (template_parms,
- DECL_TEMPLATE_PARMS (fndecl)))
- && equivalent_constraints (c1, c2)
- && (DECL_TEMPLATE_SPECIALIZATION (function)
- == DECL_TEMPLATE_SPECIALIZATION (fndecl))
- && (!DECL_TEMPLATE_SPECIALIZATION (function)
- || (DECL_TI_TEMPLATE (function)
- == DECL_TI_TEMPLATE (fndecl))))
- {
- if (pushed_scope)
- pop_scope (pushed_scope);
- return fndecl;
- }
- }
-
- error_at (DECL_SOURCE_LOCATION (function),
- "prototype for %q#D does not match any in class %qT",
- function, ctype);
+ tree pushed_scope = push_scope (ctype);
+ tree matched = NULL_TREE;
+ tree fns = lookup_fnfields_slot (ctype, DECL_NAME (function));
+
+ for (ovl_iterator iter (fns); !matched && iter; ++iter)
+ {
+ tree fndecl = *iter;
+ tree p1 = TYPE_ARG_TYPES (TREE_TYPE (function));
+ tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
+
+ /* We cannot simply call decls_match because this doesn't work
+ for static member functions that are pretending to be
+ methods, and because the name may have been changed by
+ asm("new_name"). */
+
+ /* Get rid of the this parameter on functions that become
+ static. */
+ if (DECL_STATIC_FUNCTION_P (fndecl)
+ && TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
+ p1 = TREE_CHAIN (p1);
+
+ /* A member template definition only matches a member template
+ declaration. */
+ if (is_template != (TREE_CODE (fndecl) == TEMPLATE_DECL))
+ continue;
- const char *format = NULL;
- tree first = OVL_FIRST ((*methods)[ix]);
- bool is_conv_op = DECL_CONV_FN_P (first);
- tree prev = NULL_TREE;
+ /* ref-qualifier or absence of same must match. */
+ if (type_memfn_rqual (TREE_TYPE (function))
+ != type_memfn_rqual (TREE_TYPE (fndecl)))
+ continue;
- if (is_conv_op)
- ix = CLASSTYPE_FIRST_CONVERSION_SLOT;
- do
- {
- ovl_iterator iter ((*methods)[ix++]);
- if (is_conv_op && !DECL_CONV_FN_P (*iter))
- break;
- for (; iter; ++iter)
- {
- if (prev)
- {
- if (!format)
- format = N_("candidates are: %+#D");
- error (format, prev);
- format = " %+#D";
- }
- prev = *iter;
- }
- }
- while (is_conv_op && size_t (ix) < methods->length ());
- if (prev)
+ // Include constraints in the match.
+ tree c1 = get_constraints (function);
+ tree c2 = get_constraints (fndecl);
+
+ /* While finding a match, same types and params are not enough
+ if the function is versioned. Also check version ("target")
+ attributes. */
+ if (same_type_p (TREE_TYPE (TREE_TYPE (function)),
+ TREE_TYPE (TREE_TYPE (fndecl)))
+ && compparms (p1, p2)
+ && !targetm.target_option.function_versions (function, fndecl)
+ && (!is_template
+ || comp_template_parms (template_parms,
+ DECL_TEMPLATE_PARMS (fndecl)))
+ && equivalent_constraints (c1, c2)
+ && (DECL_TEMPLATE_SPECIALIZATION (function)
+ == DECL_TEMPLATE_SPECIALIZATION (fndecl))
+ && (!DECL_TEMPLATE_SPECIALIZATION (function)
+ || (DECL_TI_TEMPLATE (function) == DECL_TI_TEMPLATE (fndecl))))
+ matched = fndecl;
+ }
+
+ if (!matched)
+ {
+ if (!COMPLETE_TYPE_P (ctype))
+ cxx_incomplete_type_error (function, ctype);
+ else
{
- if (!format)
- format = N_("candidate is: %+#D");
- error (format, prev);
+ if (DECL_CONV_FN_P (function))
+ fns = lookup_all_conversions (ctype);
+
+ error_at (DECL_SOURCE_LOCATION (function),
+ "no declaration matches %q#D", function);
+ if (fns)
+ print_candidates (fns);
+ else if (DECL_CONV_FN_P (function))
+ inform (DECL_SOURCE_LOCATION (function),
+ "no conversion operators declared");
+ else
+ inform (DECL_SOURCE_LOCATION (function),
+ "no functions named %qD", function);
+ inform (DECL_SOURCE_LOCATION (TYPE_NAME (ctype)),
+ "%#qT defined here", ctype);
}
+ matched = error_mark_node;
}
- else if (!COMPLETE_TYPE_P (ctype))
- cxx_incomplete_type_error (function, ctype);
- else
- error ("no %q#D member function declared in class %qT",
- function, ctype);
if (pushed_scope)
pop_scope (pushed_scope);
- return error_mark_node;
+
+ return matched;
}
/* DECL is a function with vague linkage. Remember it so that at the
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 79b55b5..6b6a1a6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1196,15 +1196,10 @@ retrieve_specialization (tree tmpl, tree args, hashval_t hash)
= retrieve_specialization (class_template, args, 0);
if (!class_specialization)
return NULL_TREE;
- /* Now, find the appropriate entry in the CLASSTYPE_METHOD_VEC
- for the specialization. */
- int idx = class_method_index_for_fn (class_specialization, tmpl);
- if (idx == -1)
- return NULL_TREE;
- /* Iterate through the methods with the indicated name, looking
- for the one that has an instance of TMPL. */
- vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (class_specialization);
- for (ovl_iterator iter ((*methods)[idx]); iter; ++iter)
+
+ /* Find the instance of TMPL. */
+ tree fns = lookup_fnfields_slot (class_specialization, DECL_NAME (tmpl));
+ for (ovl_iterator iter (fns); iter; ++iter)
{
tree fn = *iter;
if (DECL_TEMPLATE_INFO (fn) && DECL_TI_TEMPLATE (fn) == tmpl
@@ -2876,8 +2871,6 @@ check_explicit_specialization (tree declarator,
/* Find the list of functions in ctype that have the same
name as the declared function. */
tree name = TREE_OPERAND (declarator, 0);
- tree fns = NULL_TREE;
- int idx;
if (constructor_name_p (name, ctype))
{
@@ -2900,39 +2893,16 @@ check_explicit_specialization (tree declarator,
name = DECL_NAME (decl);
}
- if (!DECL_CONV_FN_P (decl))
- {
- idx = lookup_fnfields_1 (ctype, name);
- if (idx >= 0)
- fns = (*CLASSTYPE_METHOD_VEC (ctype))[idx];
- }
+ tree fns = NULL_TREE;
+ if (DECL_CONV_FN_P (decl))
+ /* For a type-conversion operator, we cannot do a
+ name-based lookup. We might be looking for `operator
+ int' which will be a specialization of `operator T'.
+ Grab all the conversion operators, and then select from
+ them. */
+ fns = lookup_all_conversions (ctype);
else
- {
- vec<tree, va_gc> *methods;
- tree ovl;
-
- /* For a type-conversion operator, we cannot do a
- name-based lookup. We might be looking for `operator
- int' which will be a specialization of `operator T'.
- So, we find *all* the conversion operators, and then
- select from them. */
- fns = NULL_TREE;
-
- methods = CLASSTYPE_METHOD_VEC (ctype);
- if (methods)
- for (idx = CLASSTYPE_FIRST_CONVERSION_SLOT;
- methods->iterate (idx, &ovl);
- ++idx)
- {
- if (!DECL_CONV_FN_P (OVL_FIRST (ovl)))
- /* There are no more conversion functions. */
- break;
-
- /* Glue all these conversion functions together
- with those we already have. */
- fns = lookup_add (ovl, fns);
- }
- }
+ fns = lookup_fnfields_slot_nolazy (ctype, name);
if (fns == NULL_TREE)
{
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 9d8a629..cd06e52 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1648,7 +1648,7 @@ lookup_fnfields_idx_nolazy (tree type, tree name)
/* TYPE is a class type. Return the index of the fields within
the method vector with name NAME, or -1 if no such field exists. */
-int
+static int
lookup_fnfields_1 (tree type, tree name)
{
if (!CLASS_TYPE_P (type))
@@ -1705,17 +1705,29 @@ lookup_fnfields_slot_nolazy (tree type, tree name)
return (*CLASSTYPE_METHOD_VEC (type))[ix];
}
-/* Like lookup_fnfields_1, except that the name is extracted from
- FUNCTION, which is a FUNCTION_DECL or a TEMPLATE_DECL. */
+/* Collect all the conversion operators of KLASS. */
-int
-class_method_index_for_fn (tree class_type, tree function)
+tree
+lookup_all_conversions (tree klass)
{
- gcc_assert (DECL_DECLARES_FUNCTION_P (function));
+ tree lkp = NULL_TREE;
- return lookup_fnfields_1 (class_type, DECL_NAME (function));
-}
+ if (vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (klass))
+ {
+ tree ovl;
+ for (int idx = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ methods->iterate (idx, &ovl); ++idx)
+ {
+ if (!DECL_CONV_FN_P (OVL_FIRST (ovl)))
+ /* There are no more conversion functions. */
+ break;
+
+ lkp = lookup_add (ovl, lkp);
+ }
+ }
+ return lkp;
+}
/* DECL is the result of a qualified name lookup. QUALIFYING_SCOPE is
the class or namespace used to qualify the name. CONTEXT_CLASS is
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 9589b47..e13943a 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -9081,11 +9081,9 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p)
if (assign_p)
{
- int ix;
- ix = lookup_fnfields_1 (type, cp_assignment_operator_id (NOP_EXPR));
- if (ix < 0)
+ fns = lookup_fnfields_slot (type, cp_assignment_operator_id (NOP_EXPR));
+ if (!fns)
return false;
- fns = (*CLASSTYPE_METHOD_VEC (type))[ix];
}
else if (TYPE_HAS_COPY_CTOR (type))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4d83720..2637ecc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,24 @@
+2017-06-30 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/concepts/memfun-err.C: Adjust diagnostics.
+ * g++.dg/cpp0x/decltype9.C: Likewise.
+ * g++.dg/cpp0x/forw_enum9.C: Likewise.
+ * g++.dg/lookup/decl1.C: Likewise.
+ * g++.dg/lookup/extern-c-redecl.C: Likewise.
+ * g++.dg/other/pr28432.C: Likewise.
+ * g++.dg/parse/crash12.C: Likewise.
+ * g++.dg/parse/enum3.C: Likewise.
+ * g++.dg/parse/operator6.C: Likewise.
+ * g++.dg/template/crash69.C: Likewise.
+ * g++.dg/template/error27.C: Likewise.
+ * g++.dg/template/error28.C: Likewise.
+ * g++.dg/template/memfriend6.C: Likewise.
+ * g++.old-deja/g++.mike/err1.C: Likewise.
+ * g++.old-deja/g++.mike/p811.C: Likewise.
+ * g++.old-deja/g++.other/crash25.C: Likewise.
+ * g++.old-deja/g++.other/dtor4.C: Likewise.
+ * g++.old-deja/g++.pt/t37.C: Likewise.
+
2017-06-30 Martin Liska <mliska@suse.cz>
PR ipa/81214
diff --git a/gcc/testsuite/g++.dg/concepts/memfun-err.C b/gcc/testsuite/g++.dg/concepts/memfun-err.C
index e44273c..f44610a 100644
--- a/gcc/testsuite/g++.dg/concepts/memfun-err.C
+++ b/gcc/testsuite/g++.dg/concepts/memfun-err.C
@@ -15,16 +15,16 @@ int called = 0;
// Test constrained member definitions
template<typename T>
- struct S1 {
+ struct S1 { // { dg-message "defined here" }
void f1() requires C<T>() { }
void g1() requires C<T>() and true;
template<C U> void h1(U u) { called = 1; }
- void g2() requires C<T>(); // { dg-error "candidate" }
+ void g2() requires C<T>(); // { dg-message "candidate" }
};
template<typename T>
- void S1<T>::g2() requires D<T>() { } // { dg-error "prototype" }
+ void S1<T>::g2() requires D<T>() { } // { dg-error "no declaration matches" }
int main() {
S1<X> sx;
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype9.C b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
index 9db3db0..45cd9ed 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
@@ -1,9 +1,9 @@
// PR c++/34271
// { dg-do compile { target c++11 } }
-template<int> struct A
-{
+template<int> struct A { // { dg-message "defined here" }
static int i;
};
-template<int N> int A<N>::i(decltype (A::i)); // { dg-error "member function|must be an expression" }
+template<int N> int A<N>::i(decltype (A::i)); // { dg-error "no declaration" }
+// { dg-message "no functions" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
index 4f1475a..acf16c6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
@@ -4,7 +4,7 @@
template<typename T> struct S1
{
enum E1 : int;
- enum class E2 : int;
+ enum class E2 : T;
};
template<typename T> enum S1<T>::E1 : int { e1 };
diff --git a/gcc/testsuite/g++.dg/lookup/decl1.C b/gcc/testsuite/g++.dg/lookup/decl1.C
index 42a9978..205ffcf 100644
--- a/gcc/testsuite/g++.dg/lookup/decl1.C
+++ b/gcc/testsuite/g++.dg/lookup/decl1.C
@@ -19,14 +19,13 @@ C2<X>::operator C1<Y>()
return C1<Y>();
}
-struct A
-{
- operator int (); // { dg-error "operator" }
- operator float (); // { dg-error "operator" }
- operator float () const; // { dg-error "operator" }
- template <typename T> operator T * (); // { dg-error "candidates" }
+struct A { // { dg-message "defined here" }
+ operator int (); // { dg-message "operator" }
+ operator float (); // { dg-message "operator" }
+ operator float () const; // { dg-message "operator" }
+ template <typename T> operator T * (); // { dg-message "operator" }
};
-A::operator short () { // { dg-error "prototype for" }
+A::operator short () { // { dg-error "no declaration matches" }
return 0;
}
diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
index 31d100a..3e901cc 100644
--- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
+++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C
@@ -8,4 +8,4 @@ namespace A {
// next line should trigger an error because
// it conflicts with previous declaration of foo_func (), due to
// different exception specifications.
-extern "C" void foo_func (); // { dg-error "C language|exception specifications" }
+extern "C" void foo_func (); // { dg-error "C language linkage|exception specifications" }
diff --git a/gcc/testsuite/g++.dg/other/pr28432.C b/gcc/testsuite/g++.dg/other/pr28432.C
index 2b9c763..8e24285 100644
--- a/gcc/testsuite/g++.dg/other/pr28432.C
+++ b/gcc/testsuite/g++.dg/other/pr28432.C
@@ -3,5 +3,7 @@
// { dg-options "" }
-struct A {};
-void A::foo(); // { dg-error "member function declared in class|outside of class is not definition" }
+struct A {}; // { dg-message "defined here" }
+
+void A::foo(); // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C
index 769ca2e..61921fd 100644
--- a/gcc/testsuite/g++.dg/parse/crash12.C
+++ b/gcc/testsuite/g++.dg/parse/crash12.C
@@ -6,15 +6,16 @@
template <class _Tp> class auto_ptr {};
template <class _Tp>
-class counted_ptr
-{
+class counted_ptr { // { dg-message "defined here" }
public:
- counted_ptr(::auto_ptr<_Tp>& __a); // { dg-error "candidate" }
+ counted_ptr(::auto_ptr<_Tp>& __a); // { dg-message "candidate" }
::auto_ptr<_Tp> auto_ptr();
};
template <class _Tp>
-inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required|not match|template" }
+inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a)
+// { dg-error "no declaration matches" "" { target *-*-* } .-1 }
+// { dg-error "template argument required" "" { target *-*-* } .-2 }
{
}
diff --git a/gcc/testsuite/g++.dg/parse/enum3.C b/gcc/testsuite/g++.dg/parse/enum3.C
index dc07193..81e6963 100644
--- a/gcc/testsuite/g++.dg/parse/enum3.C
+++ b/gcc/testsuite/g++.dg/parse/enum3.C
@@ -1,5 +1,7 @@
// PR c++/28261
-struct A {}; // { dg-error "A::A" }
+struct A {}; // { dg-message "A::A" }
+// { dg-message "defined here" "" { target *-*-* } .-1 }
-A::A (enum { e }) {} // { dg-error "defined|prototype" }
+A::A (enum { e }) {} // { dg-error "no declaration matches" }
+// { dg-error "in parameter types" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/parse/operator6.C b/gcc/testsuite/g++.dg/parse/operator6.C
index e58a3a6..c13860e 100644
--- a/gcc/testsuite/g++.dg/parse/operator6.C
+++ b/gcc/testsuite/g++.dg/parse/operator6.C
@@ -1,5 +1,6 @@
// PR c++/25635
-struct A {};
+struct A {}; // { dg-message "defined here" }
-A::operator int(); // { dg-error "class" }
+A::operator int(); // { dg-error "no declaration matches" }
+// { dg-message "no conversion operators" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/crash69.C b/gcc/testsuite/g++.dg/template/crash69.C
index badf70bd..21ed91b 100644
--- a/gcc/testsuite/g++.dg/template/crash69.C
+++ b/gcc/testsuite/g++.dg/template/crash69.C
@@ -3,10 +3,11 @@
template<typename T> class A
{
static int i; // { dg-message "private" }
- friend int T::foo(); // { dg-error "does not match" }
+ friend int T::foo(); // { dg-error "no declaration matches" }
};
struct B
{
- void foo() { A<B>::i; } // { dg-error "within|candidate" }
+ void foo() { A<B>::i; } // { dg-message "candidate" }
+ // { dg-error "private within" "" { target *-*-* } .-1 }
};
diff --git a/gcc/testsuite/g++.dg/template/error27.C b/gcc/testsuite/g++.dg/template/error27.C
index 8d41d02..7f15f8c 100644
--- a/gcc/testsuite/g++.dg/template/error27.C
+++ b/gcc/testsuite/g++.dg/template/error27.C
@@ -1,5 +1,6 @@
// PR c++/27211
-struct A {};
+struct A {}; // { dg-message "defined here" }
-template<int> void A::foo() {} // { dg-error "member function" }
+template<int> void A::foo() {} // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/error28.C b/gcc/testsuite/g++.dg/template/error28.C
index e87d542..d4cf031 100644
--- a/gcc/testsuite/g++.dg/template/error28.C
+++ b/gcc/testsuite/g++.dg/template/error28.C
@@ -1,5 +1,6 @@
// PR c++/27211
-struct A {};
+struct A {}; // { dg-message "defined here" }
-template<int> void A::foo(); // { dg-error "member function" }
+template<int> void A::foo(); // { dg-error "no declaration matches" }
+// { dg-message "no functions named" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/template/memfriend6.C b/gcc/testsuite/g++.dg/template/memfriend6.C
index 5f82339..4f126862 100644
--- a/gcc/testsuite/g++.dg/template/memfriend6.C
+++ b/gcc/testsuite/g++.dg/template/memfriend6.C
@@ -6,18 +6,21 @@
// Member function of class template as friend
// Erroneous case: mismatch during declaration
-template <class T> struct A {
- template <class U> void f(U); // { dg-error "candidate" }
- void g(); // { dg-error "candidate|with" }
- void h(); // { dg-error "candidate|with" }
- void i(int); // { dg-error "candidate" }
+template <class T> struct A { // { dg-message "defined here" }
+ template <class U> void f(U); // { dg-message "candidate" }
+ void g(); // { dg-message "candidate" }
+ void h(); // { dg-message "candidate" }
+ void i(int); // { dg-message "candidate" }
};
class C {
int ii;
- template <class U> friend void A<U>::f(U); // { dg-error "not match" }
+ template <class U>
+ friend void A<U>::f(U); // { dg-error "no declaration matches" }
template <class U> template <class V>
- friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" }
- template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" }
- template <class U> friend void A<U>::i(char); // { dg-error "not match" }
+ friend void A<U>::g(); // { dg-error "no declaration matches" }
+ template <class U>
+ friend int A<U>::h(); // { dg-error "no declaration matches" }
+ template <class U>
+ friend void A<U>::i(char); // { dg-error "no declaration matches" }
};
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/err1.C b/gcc/testsuite/g++.old-deja/g++.mike/err1.C
index 8e15dd2..90f4ce6 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/err1.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/err1.C
@@ -1,8 +1,8 @@
// { dg-do assemble }
-struct gorf {
+struct gorf { // { dg-message "defined here" }
int stuff;
- void snarf(); // { dg-error "" }
+ void snarf(); // { dg-message "" }
};
-template <class T> void gorf::snarf() { return; } // { dg-error "" }
+template <class T> void gorf::snarf() { return; } // { dg-error "no declaration" }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p811.C b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
index 260c645..5c8260a 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p811.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
@@ -515,21 +515,22 @@ public:
virtual char *stringify2() const = 0; // { dg-error "overriding" }
};
-class X: public Y {
+class X: public Y { // { dg-message "defined here" }
public:
X(): Y() {}
- const char *stringify(); // { dg-error "candidate" }
- const char *stringify2() const; // { dg-error "candidate|conflicting return type" }
+ const char *stringify(); // { dg-message "candidate" }
+ const char *stringify2() const; // { dg-message "candidate" }
+ // { dg-error "conflicting return type" "" { target *-*-* } .-1 }
};
char *
-X::stringify() const // { dg-error "does not match" }
+X::stringify() const // { dg-error "no declaration matches" }
{
return "stringify";
}
const char *
-X::stringify2() // { dg-error "does not match" }
+X::stringify2() // { dg-error "no declaration matches" }
{
return "stringify2";
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash25.C b/gcc/testsuite/g++.old-deja/g++.other/crash25.C
index 5b313db..0611286 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/crash25.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/crash25.C
@@ -9,7 +9,8 @@ public:
virtual ~X();
}
-X::x() // { dg-error "6:no 'X X::x\\(\\)' member function declared in class 'X'" }
+X::x() // { dg-error "1:no declaration matches" }
+// { dg-message "1:no functions named" "note" { target *-*-* } .-1 }
{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
index a4db38b..b7ae370 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C
@@ -1,10 +1,10 @@
// { dg-do assemble }
-struct S1 {
- ~S1(); // { dg-error "" } candidate
+struct S1 { // { dg-message "defined here" }
+ ~S1(); // { dg-message "candidate" }
};
-S1::~S1() const // { dg-error "" } prototype does not match
+S1::~S1() const // { dg-error "no declaration matches" }
{
}
@@ -15,12 +15,12 @@ struct S2 {
template <class T>
-struct S3 {
- ~S3(); // { dg-error "" } candidate
+struct S3 { // { dg-message "defined here" }
+ ~S3(); // { dg-message "candidate" }
};
template <class T>
-S3<T>::~S3() volatile // { dg-error "" } prototype does not match
+S3<T>::~S3() volatile // { dg-error "no declaration matches" }
{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/t37.C b/gcc/testsuite/g++.old-deja/g++.pt/t37.C
index 99348c0..dbf1f44 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/t37.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/t37.C
@@ -1,9 +1,10 @@
-// { dg-do assemble }
+// { dg-do compile }
-class A { // { dg-error "" } synthesized copy ctor
+class A { // { dg-message "A::A" } synthesized copy ctor
+ // { dg-message "defined here" "note" { target *-*-* } .-1 }
public:
- A(int); // { dg-error "" } referenced below
- A(float); // { dg-error "" } referenced below
+ A(int); // { dg-message "A::A" }
+ A(float); // { dg-message "A::A" }
~A();
};