public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104179] New: Truncated representation of character arrays as non-type template parameters
@ 2022-01-22 5:51 stinkingmadgod at gmail dot com
2022-01-22 20:34 ` [Bug c++/104179] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: stinkingmadgod at gmail dot com @ 2022-01-22 5:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104179
Bug ID: 104179
Summary: Truncated representation of character arrays as
non-type template parameters
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: stinkingmadgod at gmail dot com
Target Milestone: ---
#include<algorithm>
template<unsigned N>
struct str
{
char data[N];
consteval str(const char (&arr)[N])
{
std::copy(arr, arr + N, data);
}
};
template<str>
struct print;
constexpr char s[] = {'4', '2'};
print<s> p;
Produces the error message
<source>:17:10: error: aggregate 'print<str<2>{"4"}> p' has incomplete type and
cannot be defined
17 | print<s> p;
Where print<str<2>{"4"}> should be print<str<2>{"42"}>
The intention is likely to print null-terminated strings correctly, as in
print<"42"> p2;
<source>:16:13: error: aggregate 'print<str<3>{"42"}> p2' has incomplete type
and cannot be defined
16 | print<"42"> p2;
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/104179] Truncated representation of character arrays as non-type template parameters
2022-01-22 5:51 [Bug c++/104179] New: Truncated representation of character arrays as non-type template parameters stinkingmadgod at gmail dot com
@ 2022-01-22 20:34 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 20:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104179
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-01-22
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-22 20:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 5:51 [Bug c++/104179] New: Truncated representation of character arrays as non-type template parameters stinkingmadgod at gmail dot com
2022-01-22 20:34 ` [Bug c++/104179] " pinskia at gcc dot gnu.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).