re PR c++/46336 ([C++0X] ICE on invalid: in register_constexpr_fundef, at cp/semantics.c:5571)
PR c++/46336 * decl.c (duplicate_decls): Return NULL_TREE for clashing C functions. From-SVN: r171084
This commit is contained in:
parent
3f7c745381
commit
9f2a22d0b8
@ -1,5 +1,9 @@
|
||||
2011-03-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/46336
|
||||
* decl.c (duplicate_decls): Return NULL_TREE for clashing
|
||||
C functions.
|
||||
|
||||
PR c++/47570
|
||||
* semantics.c (cxx_eval_constant_expression) [COMPOUND_EXPR]: Don't
|
||||
use the generic binary expression handling.
|
||||
|
@ -1456,6 +1456,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
|
||||
error ("declaration of C function %q#D conflicts with",
|
||||
newdecl);
|
||||
error ("previous declaration %q+#D here", olddecl);
|
||||
return NULL_TREE;
|
||||
}
|
||||
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
|
||||
TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
|
||||
|
@ -1,5 +1,8 @@
|
||||
2011-03-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/constexpr-46336.C: New.
|
||||
* g++.dg/parse/friend5.C: Adjust expected errors.
|
||||
|
||||
* g++.dg/cpp0x/constexpr-47570.C: New.
|
||||
|
||||
2011-03-16 Dodji Seketeli <dodji@redhat.com>
|
||||
|
14
gcc/testsuite/g++.dg/cpp0x/constexpr-46336.C
Normal file
14
gcc/testsuite/g++.dg/cpp0x/constexpr-46336.C
Normal file
@ -0,0 +1,14 @@
|
||||
// PR c++/46336
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
extern "C" {
|
||||
enum A { };
|
||||
inline constexpr A
|
||||
f(A a, A b) // { dg-error "previous declaration" }
|
||||
{ return A(static_cast<int>(a) & static_cast<int>(b)); }
|
||||
enum B { };
|
||||
inline constexpr B
|
||||
f(B a, B b) // { dg-error "C function" }
|
||||
{ return B(static_cast<int>(a) & static_cast<int>(b)); }
|
||||
}
|
||||
|
@ -4,5 +4,4 @@ extern "C" struct A
|
||||
{
|
||||
friend void foo(int) {} // { dg-error "declaration" }
|
||||
friend void foo() {} // { dg-error "foo" "err" }
|
||||
// { dg-warning "already a friend" "warn" { target *-*-* } 6 }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user