public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/109049] New: std::declval gives wrong result for cv void
@ 2023-03-07  6:18 fsb4000 at yandex dot ru
  2023-03-07 12:23 ` [Bug libstdc++/109049] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fsb4000 at yandex dot ru @ 2023-03-07  6:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109049
           Summary: std::declval gives wrong result for cv void
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fsb4000 at yandex dot ru
  Target Milestone: ---

A. Jiang <de34@live.cn> found that:

Quote:

"The return type is... cursed for cv void.

It seems that decltype(std::declval<const void>) should be const void() (until
C++17) / const void() noexcept (since C++17) (same for volatile void and const
volatile void), but the cv-qualifiers are dropped"

Code example:

#include <utility>
#include <type_traits>

int main() {
    static_assert(std::is_same_v<decltype(std::declval<const void>), const void
() noexcept>);
    static_assert(std::is_same_v<decltype(std::declval<volatile void>),
volatile void () noexcept>);
}


https://gcc.godbolt.org/z/TMe3v9sxh

I've created the same issue for libc++:
https://github.com/llvm/llvm-project/issues/61232

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

end of thread, other threads:[~2023-03-07 15:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07  6:18 [Bug libstdc++/109049] New: std::declval gives wrong result for cv void fsb4000 at yandex dot ru
2023-03-07 12:23 ` [Bug libstdc++/109049] " redi at gcc dot gnu.org
2023-03-07 12:32 ` redi at gcc dot gnu.org
2023-03-07 15:07 ` de34 at live dot cn
2023-03-07 15:43 ` redi 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).