public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103809] New: spurious reporting of structure redefinition
@ 2021-12-22 18:23 florin at iucha dot net
2021-12-22 20:42 ` [Bug c++/103809] " redi at gcc dot gnu.org
2021-12-23 12:55 ` [Bug c++/103809] wrong reporting of (template) struct redefinition when doing a more constrained template outside of the namespace ppalka at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: florin at iucha dot net @ 2021-12-22 18:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103809
Bug ID: 103809
Summary: spurious reporting of structure redefinition
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: florin at iucha dot net
Target Milestone: ---
Consider the following program:
/*********************************************************/
#include <concepts>
namespace priv
{
template<typename Value>
struct Struct {};
}
#ifdef SHOW_BUG
template<std::integral Integral>
struct priv::Struct<Integral> {};
// This way results in:
// <source>:19:14: error: redefinition of 'struct priv::Struct<Integral>'
// 19 | struct priv::Struct<Float> {};
// | ^~~~~~~~~~~~~
template<std::floating_point Float>
struct priv::Struct<Float> {};
#else
namespace priv
{
template<std::integral Integral>
struct Struct<Integral> {};
template<std::floating_point Float>
struct Struct<Float> {};
}
#endif
int main() {}
/*********************************************************/
Compiling with "g++ -std=c++20 -DSHOW_BUG" results in
<source>:19:14: error: redefinition of 'struct priv::Struct<Integral>'
19 | struct priv::Struct<Float> {};
| ^~~~~~~~~~~~~
<source>:12:14: note: previous definition of 'struct priv::Struct<Integral>'
12 | struct priv::Struct<Integral> {};
| ^~~~~~~~~~~~~~~~
ASM generation compiler returned: 1
<source>:19:14: error: redefinition of 'struct priv::Struct<Integral>'
19 | struct priv::Struct<Float> {};
| ^~~~~~~~~~~~~
<source>:12:14: note: previous definition of 'struct priv::Struct<Integral>'
12 | struct priv::Struct<Integral> {};
| ^~~~~~~~~~~~~~~~
Compiling without SHOW_BUG results in no error.
(Bug found by my colleague, Ramon Sibello).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-23 12:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 18:23 [Bug c++/103809] New: spurious reporting of structure redefinition florin at iucha dot net
2021-12-22 20:42 ` [Bug c++/103809] " redi at gcc dot gnu.org
2021-12-23 12:55 ` [Bug c++/103809] wrong reporting of (template) struct redefinition when doing a more constrained template outside of the namespace ppalka 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).