re PR c++/51150 ([C++11][4.6/4.7 Regression] ICE when result of -> initializes const variable of different type)
/cp 2011-11-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51150 * pt.c (tsubst_copy_and_build): Handle FIX_TRUNC_EXPR. /testsuite 2011-11-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51150 * g++.dg/cpp0x/pr51150.C: New. From-SVN: r181478
This commit is contained in:
parent
39cc8c3d6b
commit
112eadc763
@ -1,3 +1,8 @@
|
||||
2011-11-18 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51150
|
||||
* pt.c (tsubst_copy_and_build): Handle FIX_TRUNC_EXPR.
|
||||
|
||||
2011-11-18 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51191
|
||||
|
@ -13387,6 +13387,10 @@ tsubst_copy_and_build (tree t,
|
||||
return build_x_unary_op (TREE_CODE (t), RECUR (TREE_OPERAND (t, 0)),
|
||||
complain);
|
||||
|
||||
case FIX_TRUNC_EXPR:
|
||||
return cp_build_unary_op (FIX_TRUNC_EXPR, RECUR (TREE_OPERAND (t, 0)),
|
||||
0, complain);
|
||||
|
||||
case ADDR_EXPR:
|
||||
op1 = TREE_OPERAND (t, 0);
|
||||
if (TREE_CODE (op1) == LABEL_DECL)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2011-11-18 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51150
|
||||
* g++.dg/cpp0x/pr51150.C: New.
|
||||
|
||||
2011-11-18 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR tree-optimization/50605
|
||||
|
20
gcc/testsuite/g++.dg/cpp0x/pr51150.C
Normal file
20
gcc/testsuite/g++.dg/cpp0x/pr51150.C
Normal file
@ -0,0 +1,20 @@
|
||||
// PR c++/51150
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
struct Clock {
|
||||
double Now();
|
||||
};
|
||||
template <class T> void Foo(Clock* clock) {
|
||||
const int now = clock->Now();
|
||||
}
|
||||
|
||||
template void Foo<float>(Clock*);
|
||||
|
||||
template <class T> void Boo(int val) {
|
||||
const int now1 = (double)(val);
|
||||
const int now2 = const_cast<double>(val); // { dg-error "invalid" }
|
||||
const int now3 = static_cast<double>(val);
|
||||
const int now4 = reinterpret_cast<double>(val); // { dg-error "invalid" }
|
||||
}
|
||||
|
||||
template void Boo<float>(int);
|
Loading…
Reference in New Issue
Block a user