public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20140] New: template function complains about "char-array initialized from wide string"
@ 2005-02-22 17:06 rwxr-xr-x at gmx dot de
2005-02-22 17:13 ` [Bug c++/20140] " reichelt at gcc dot gnu dot org
0 siblings, 1 reply; 6+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2005-02-22 17:06 UTC (permalink / raw)
To: gcc-bugs
Hello,
this is my code:
template<typename T> void foo() {
unsigned char s[] = "";
(void)s;
}
int main() {
/* removing either of the calls below makes the error disappear */
foo<int>();
foo<char>();
}
Compiling this program with g++[0] results in
try.cc: In function `void foo() [with T = char]':
try.cc:9: instantiated from here
try.cc:2: error: char-array initialized from wide string
I think this is wrong because "" isn't a wide string. The error disappears
when I remove "unsigned" from the declaration of s, or when only a single
foo<T> is instantiated. The actual types don't matter; my original code
used function pointers.
HTH, Lukas
[0] g++ versions:
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --with-cpu=i686 --with-arch=i686 --with-tune=i686 --enable-__cxa_atexit
Thread model: posix
gcc version 3.4.3
Reading specs from /usr/local/dist/bin/../lib/gcc-lib/sparc-sun-solaris2.8/3.2.2/specs
Configured with: /compilefs/usr.local.compile/dist/fenk/gcc-3.2.2/configure --prefix=/usr/local/dist/DIR/GNU/gcc-3.2.2 --with-gnu-as --with-as=/usr/local/dist/DIR/GNU/binutils/bin/as --with-gnu-ld --with-ld=/usr/local/dist/DIR/GNU/binutils/bin/ld --with-dwarf2 --disable-multilib --with-local-prefix=/usr/local/dist
Thread model: posix
gcc version 3.2.2
--
Summary: template function complains about "char-array
initialized from wide string"
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rwxr-xr-x at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/20140] template function complains about "char-array initialized from wide string"
2005-02-22 17:06 [Bug c++/20140] New: template function complains about "char-array initialized from wide string" rwxr-xr-x at gmx dot de
@ 2005-02-22 17:13 ` reichelt at gcc dot gnu dot org
0 siblings, 0 replies; 6+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-22 17:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-02-22 12:56 -------
Confirmed.
This fails since gcc 2.95.3 or earlier.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |monitored, rejects-valid
Last reconfirmed|0000-00-00 00:00:00 |2005-02-22 12:56:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/20140] template function complains about "char-array initialized from wide string"
[not found] <bug-20140-4@http.gcc.gnu.org/bugzilla/>
2012-01-02 0:42 ` paolo.carlini at oracle dot com
2012-01-02 16:16 ` paolo at gcc dot gnu.org
@ 2012-01-02 16:17 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-02 16:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-02 16:16:52 UTC ---
Fixed for 4.7.0.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/20140] template function complains about "char-array initialized from wide string"
[not found] <bug-20140-4@http.gcc.gnu.org/bugzilla/>
2012-01-02 0:42 ` paolo.carlini at oracle dot com
@ 2012-01-02 16:16 ` paolo at gcc dot gnu.org
2012-01-02 16:17 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-01-02 16:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-01-02 16:15:55 UTC ---
Author: paolo
Date: Mon Jan 2 16:15:49 2012
New Revision: 182805
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182805
Log:
/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.
Added:
trunk/gcc/testsuite/g++.dg/template/init9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/20140] template function complains about "char-array initialized from wide string"
[not found] <bug-20140-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-02 0:42 ` paolo.carlini at oracle dot com
2012-01-02 16:16 ` paolo at gcc dot gnu.org
2012-01-02 16:17 ` paolo.carlini at oracle dot com
2 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-02 0:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC|gcc-bugs at gcc dot gnu.org |
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-02 00:42:34 UTC ---
On it. I see what's going wrong, fixing it should be relatively easy.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/20140] template function complains about "char-array initialized from wide string"
[not found] <bug-20140-9632@http.gcc.gnu.org/bugzilla/>
@ 2008-03-13 9:29 ` rwxr-xr-x at gmx dot de
0 siblings, 0 replies; 6+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2008-03-13 9:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rwxr-xr-x at gmx dot de 2008-03-13 09:28 -------
Heh, this "new" bug still exists in 4.3.0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20140
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-02 16:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-22 17:06 [Bug c++/20140] New: template function complains about "char-array initialized from wide string" rwxr-xr-x at gmx dot de
2005-02-22 17:13 ` [Bug c++/20140] " reichelt at gcc dot gnu dot org
[not found] <bug-20140-9632@http.gcc.gnu.org/bugzilla/>
2008-03-13 9:29 ` rwxr-xr-x at gmx dot de
[not found] <bug-20140-4@http.gcc.gnu.org/bugzilla/>
2012-01-02 0:42 ` paolo.carlini at oracle dot com
2012-01-02 16:16 ` paolo at gcc dot gnu.org
2012-01-02 16:17 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).