public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113470] New: Should std::tuple_size<const int> be a complete type?
@ 2024-01-18  7:42 de34 at live dot cn
  2024-01-18 16:38 ` [Bug libstdc++/113470] " daniel.kruegler at googlemail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: de34 at live dot cn @ 2024-01-18  7:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113470

            Bug ID: 113470
           Summary: Should std::tuple_size<const int> be a complete type?
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

The following code snippet is currently showing implementation divergence
(https://godbolt.org/z/P8oWqf5sT). MSVC STL's std::tuple_size<const int> is a
complete type, while libstdc++'s and libc++'s are not.
```
#include <tuple>

// constexpr auto foo = sizeof(std::tuple_size<int>);    // Correctly rejected.
constexpr auto bar = sizeof(std::tuple_size<const int>); // Should be
well-formed?
```

It seems that MSVC STL's behavior is justified by
https://eel.is/c++draft/contents#1 and https://eel.is/c++draft/tuple.syn, given
that only the primary templates of std::tuple_size and std::tuple_element are
marked `// not defined`.

I'm not sure whether this should be considered as a bug. Perhaps an LWG issue
is wanted.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/113470] Should std::tuple_size<const int> be a complete type?
  2024-01-18  7:42 [Bug libstdc++/113470] New: Should std::tuple_size<const int> be a complete type? de34 at live dot cn
@ 2024-01-18 16:38 ` daniel.kruegler at googlemail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2024-01-18 16:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113470

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
I think the essence is how [tuple.helper] p4 is specified. Combining with
[tuple.syn],

template<class T> struct tuple_size; // not defined
template<class T> struct tuple_size<const T>;

I tend to read that a definition is required for tuple_size<const T>. I would
understand if that interpretation is not universally accepted.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-18 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18  7:42 [Bug libstdc++/113470] New: Should std::tuple_size<const int> be a complete type? de34 at live dot cn
2024-01-18 16:38 ` [Bug libstdc++/113470] " daniel.kruegler at googlemail 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).