public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/16245] New: Invalid converion of array types. @ 2004-06-28 13:55 vassili_bourdo at softhome dot net 2004-06-28 13:59 ` [Bug c++/16245] " vassili_bourdo at softhome dot net ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: vassili_bourdo at softhome dot net @ 2004-06-28 13:55 UTC (permalink / raw) To: gcc-bugs The code: ------------------------------------------- typedef char(arr_type)[10]; typedef char(&arr_ref)[10]; arr_ref fn() { static arr_type a = {1,2,3,4}; return arr_ref(a); //return a; } ------------------------------------------- Fails to compile on Mingw GCC-3.4.0 with diagnostics: ------------------------------------------- bug.cxx: In function `char (& fn())[10]': bug.cxx:7: error: conversion to non-const reference type `char (&)[10]' from rvalue of type `char*' bug.cxx:7: error: invalid initialization of non-const reference of type 'char (&)[10]' from a temporary of type 'char*' ------------------------------------------- However if replace "return arr_ref(a);" with "return a;" it compiles -- Summary: Invalid converion of array types. Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vassili_bourdo at softhome dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16245 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/16245] Invalid converion of array types. 2004-06-28 13:55 [Bug c++/16245] New: Invalid converion of array types vassili_bourdo at softhome dot net @ 2004-06-28 13:59 ` vassili_bourdo at softhome dot net 2004-06-28 14:19 ` [Bug c++/16245] Arrays decay too quickly bangerth at dealii dot org 2005-06-19 15:05 ` pinskia at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: vassili_bourdo at softhome dot net @ 2004-06-28 13:59 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |3.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16245 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/16245] Arrays decay too quickly 2004-06-28 13:55 [Bug c++/16245] New: Invalid converion of array types vassili_bourdo at softhome dot net 2004-06-28 13:59 ` [Bug c++/16245] " vassili_bourdo at softhome dot net @ 2004-06-28 14:19 ` bangerth at dealii dot org 2005-06-19 15:05 ` pinskia at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: bangerth at dealii dot org @ 2004-06-28 14:19 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From bangerth at dealii dot org 2004-06-28 14:17 ------- Confirmed. This seems like another instance where we decay arrays to pointers too quickly. W. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Known to fail|3.4.0 |3.4.0 3.3.4 3.5.0 Last reconfirmed|0000-00-00 00:00:00 |2004-06-28 14:17:20 date| | Summary|Invalid converion of array |Arrays decay too quickly |types. | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16245 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/16245] Arrays decay too quickly 2004-06-28 13:55 [Bug c++/16245] New: Invalid converion of array types vassili_bourdo at softhome dot net 2004-06-28 13:59 ` [Bug c++/16245] " vassili_bourdo at softhome dot net 2004-06-28 14:19 ` [Bug c++/16245] Arrays decay too quickly bangerth at dealii dot org @ 2005-06-19 15:05 ` pinskia at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-06-19 15:05 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-19 15:05 ------- Fixed in 4.0.0 and above. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Keywords| |rejects-valid Known to fail|3.4.0 3.3.4 4.0.0 |3.4.0 3.3.4 Resolution| |FIXED Target Milestone|--- |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16245 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-19 15:05 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-06-28 13:55 [Bug c++/16245] New: Invalid converion of array types vassili_bourdo at softhome dot net 2004-06-28 13:59 ` [Bug c++/16245] " vassili_bourdo at softhome dot net 2004-06-28 14:19 ` [Bug c++/16245] Arrays decay too quickly bangerth at dealii dot org 2005-06-19 15:05 ` pinskia at gcc dot gnu dot org
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).