re PR c++/82401 (error: qsort comparator non-negative on sorted output: 1 in insert_late_enum_def_bindings on an invalid code)

PR c++/82401
	* name-lookup.c (member_name_cmp): Return 0 if a == b.

	* g++.dg/cpp0x/pr82401.C: New test.

From-SVN: r255084
This commit is contained in:
Jakub Jelinek 2017-11-22 23:35:52 +01:00 committed by Jakub Jelinek
parent 52af380439
commit 6c19e703de
4 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2017-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/82401
* name-lookup.c (member_name_cmp): Return 0 if a == b.
2017-11-22 David Malcolm <dmalcolm@redhat.com>
PR c++/62170

View file

@ -1469,7 +1469,10 @@ member_name_cmp (const void *a_p, const void *b_p)
how we order these. Use UID as a proxy for source ordering, so
that identically-located decls still have a well-defined stable
ordering. */
return DECL_UID (a) < DECL_UID (b) ? -1 : +1;
if (DECL_UID (a) != DECL_UID (b))
return DECL_UID (a) < DECL_UID (b) ? -1 : +1;
gcc_assert (a == b);
return 0;
}
static struct {

View file

@ -1,3 +1,8 @@
2017-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/82401
* g++.dg/cpp0x/pr82401.C: New test.
2017-11-22 David Malcolm <dmalcolm@redhat.com>
PR tree-optimization/82588

View file

@ -0,0 +1,16 @@
// PR c++/82401
// { dg-do compile { target c++11 } }
// { dg-options "" }
template <typename T> struct A
{
enum E : T;
void h ();
};
template <typename T> enum A<T>::E : T { e1, e2 };
template <> enum A<long long>::E : long long {};
template <typename T> struct C
{
enum class E : T;
};
C<int>::E c3 = C<int>::E::e1; // { dg-error "is not a member of" }