This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52282] [C++0x] ICE / confused by earlier errors with decltype/constexpr
- From: "paolo.carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 May 2012 09:50:43 +0000
- Subject: [Bug c++/52282] [C++0x] ICE / confused by earlier errors with decltype/constexpr
- Auto-submitted: auto-generated
- References: <bug-52282-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52282
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-07
CC| |paolo.carlini at oracle dot
| |com
Ever Confirmed|0 |1
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-07 09:50:43 UTC ---
For concreteness, with the below patchlet (for the record, about the
cxx_eval_call_expression bits, in build_data_member_initialization we have
something quite similar) all the test pass, besides the four lines:
static_assert((c.*W_<int(C::*)()const, &C::c1>::value)() == 10, "oops");
static_assert((c.*X_<int(C::*)()const, &C::c1>::value)() == 10, "oops");
static_assert((c.*Y_<int(C::*)()const, &C::c1>::value)() == 10, "oops");
static_assert((c.*Z_<int(C::*)()const, &C::c1>::value)() == 10, "oops");
///////////////
Index: semantics.c
===================================================================
--- semantics.c (revision 187228)
+++ semantics.c (working copy)
@@ -5269,6 +5269,7 @@ finish_decltype_type (tree expr, bool id_expressio
case INTEGER_CST:
case PTRMEM_CST:
+ case ADDR_EXPR:
/* We can get here when the id-expression refers to an
enumerator or non-type template parameter. */
type = TREE_TYPE (expr);
@@ -6488,6 +6489,12 @@ cxx_eval_call_expression (const constexpr_call *ol
/* Might be a constexpr function pointer. */
fun = cxx_eval_constant_expression (old_call, fun, allow_non_constant,
/*addr*/false, non_constant_p);
+ if (TREE_CODE (fun) == NOP_EXPR)
+ {
+ tree tmp = fun;
+ STRIP_NOPS (tmp);
+ fun = tmp;
+ }
if (TREE_CODE (fun) == ADDR_EXPR)
fun = TREE_OPERAND (fun, 0);
}