re PR c++/20140 (template function complains about "char-array initialized from wide string")
/cp 2012-01-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/20140 * typeck2.c (digest_init_r): Use copy_init when initializing an array of chars. /testsuite 2012-01-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/20140 * g++.dg/template/init9.C: New. From-SVN: r182805
This commit is contained in:
parent
842322d3aa
commit
7d510a821a
@ -1,3 +1,9 @@
|
||||
2012-01-02 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/20140
|
||||
* typeck2.c (digest_init_r): Use copy_init when initializing
|
||||
an array of chars.
|
||||
|
||||
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/16603
|
||||
|
@ -902,7 +902,11 @@ digest_init_r (tree type, tree init, bool nested, int flags,
|
||||
}
|
||||
}
|
||||
|
||||
TREE_TYPE (init) = type;
|
||||
if (type != TREE_TYPE (init))
|
||||
{
|
||||
init = copy_node (init);
|
||||
TREE_TYPE (init) = type;
|
||||
}
|
||||
if (TYPE_DOMAIN (type) != 0 && TREE_CONSTANT (TYPE_SIZE (type)))
|
||||
{
|
||||
int size = TREE_INT_CST_LOW (TYPE_SIZE (type));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2012-01-02 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/20140
|
||||
* g++.dg/template/init9.C: New.
|
||||
|
||||
2012-01-02 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
* gcc.dg/memcpy-4.c: Add nomips16 attribute for MIPS targets.
|
||||
|
12
gcc/testsuite/g++.dg/template/init9.C
Normal file
12
gcc/testsuite/g++.dg/template/init9.C
Normal file
@ -0,0 +1,12 @@
|
||||
// PR c++/20140
|
||||
|
||||
template<typename T> void foo()
|
||||
{
|
||||
unsigned char s[] = "";
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
foo<char>();
|
||||
foo<int>();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user