2009-11-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35112
* pt.c (print_overloaded_functions): New.
(print_candidates): Call the latter.
* parser.c (cp_parser_class_name): Do not duplicate the diagnostics
after the cp_parser_lookup_name call.
/testsuite
2009-11-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/35112
* g++.dg/parse/crash53.C: New.
* g++.dg/parse/error17.C: Adjust, error messages are not
duplicated anymore.
* g++.dg/template/dtor7.C: Remove xfail-ed dg-bogus directives.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154698
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-11-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/35112
+ * pt.c (print_overloaded_functions): New.
+ (print_candidates): Call the latter.
+ * parser.c (cp_parser_class_name): Do not duplicate the diagnostics
+ after the cp_parser_lookup_name call.
+
2009-11-26 Jason Merrill <jason@redhat.com>
PR c++/42026, DR 239
identifier_token->location);
if (ambiguous_decls)
{
- error_at (identifier_token->location,
- "reference to %qD is ambiguous", identifier);
- print_candidates (ambiguous_decls);
if (cp_parser_parsing_tentatively (parser))
- {
- identifier_token->ambiguous_p = true;
- cp_parser_simulate_error (parser);
- }
+ cp_parser_simulate_error (parser);
return error_mark_node;
}
}
return !uses_template_parms (CLASSTYPE_TI_ARGS (type));
}
+/* Print the list of overloaded FNS in an error message. */
+
+static void
+print_overloaded_functions (tree fns, const char **str)
+{
+ tree fn;
+ for (fn = fns; fn; fn = OVL_NEXT (fn))
+ {
+ if (TREE_CODE (fn) == TREE_LIST)
+ print_candidates (fn);
+ else
+ error ("%s %+#D", *str, OVL_CURRENT (fn));
+ *str = " ";
+ }
+}
+
/* Print the list of candidate FNS in an error message. */
void
print_candidates (tree fns)
{
- tree fn;
- tree f;
-
const char *str = "candidates are:";
if (is_overloaded_fn (fns))
+ print_overloaded_functions (fns, &str);
+ else
{
- for (f = fns; f; f = OVL_NEXT (f))
- {
- error ("%s %+#D", str, OVL_CURRENT (f));
- str = " ";
- }
- }
- else for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn))
- {
- for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f))
- error ("%s %+#D", str, OVL_CURRENT (f));
- str = " ";
+ tree fn;
+ for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn))
+ print_overloaded_functions (TREE_VALUE (fn), &str);
}
}
+2009-11-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/35112
+ * g++.dg/parse/crash53.C: New.
+ * g++.dg/parse/error17.C: Adjust, error messages are not
+ duplicated anymore.
+ * g++.dg/template/dtor7.C: Remove xfail-ed dg-bogus directives.
+
2009-11-27 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/vperm-v4sf-1.c (dg-options): Use -msse2.
--- /dev/null
+// PR c++/35112
+
+namespace X { struct A; } // { dg-error "struct X::A" }
+namespace Y { struct A; } // { dg-error "struct Y::A" }
+namespace Z { struct A; } // { dg-error "struct Z::A" }
+namespace W { struct A; } // { dg-error "struct W::A" }
+
+using namespace X;
+using namespace Y;
+using namespace Z;
+using namespace W;
+
+A* p; // { dg-error "reference to 'A' is ambiguous|'A' does not name a type" }
// PR c++/16965
template <typename T> struct B {
- static int Bar(T); // { dg-error "14:candidates are: " "1" }
- // { dg-error "14:with T = int" "2" { target *-*-* } 5 }
+ static int Bar(T); // { dg-error "14:candidates are: |with T = int" }
};
struct D : B<int>, B<char> {};
-int i2 = D::Bar(2); // { dg-error "13:reference to 'Bar' is ambiguous" }
-// { dg-error "10:reference to 'Bar' is ambiguous" "2" { target *-*-* } 10 }
+int i2 = D::Bar(2); // { dg-error "10:reference to 'Bar' is ambiguous" }
// PR c++/40373
// { dg-compile }
-struct A; // { dg-bogus "candidates are" "" { xfail *-*-* } }
+struct A;
namespace
{
- struct A; // { dg-bogus "struct" "" { xfail *-*-* } }
+ struct A;
}
struct B {};
{
foo (B ()); // { dg-bogus "instantiated from here" "" { xfail *-*-* } }
}
-
-// { dg-bogus "is ambiguous" "" { xfail *-*-* } 15 }