public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96330] New: Constexpr variables cannot be used in the template context.
@ 2020-07-27 11:55 steve_green at qq dot com
  2020-07-27 15:35 ` [Bug c++/96330] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: steve_green at qq dot com @ 2020-07-27 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96330
           Summary: Constexpr variables cannot be used in the template
                    context.
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: steve_green at qq dot com
  Target Milestone: ---

demo code:
struct foo_t {
    template<class T>
        static constexpr bool bar = true;
};
inline constexpr foo_t foo{};

template<class T>
    struct baz {
        static_assert(foo.bar<T>); // bug in clang (before instantiation) and
gcc (during instantiation)
        static_assert(foo_t::bar<T>); // OK
    };

int main()
{
    static_assert(foo.bar<void>, ""); // OK
    static_assert(foo_t::bar<void>, ""); // OK
    static_cast<void>(baz<void>{});
}

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

end of thread, other threads:[~2021-03-06 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 11:55 [Bug c++/96330] New: Constexpr variables cannot be used in the template context steve_green at qq dot com
2020-07-27 15:35 ` [Bug c++/96330] " jakub at gcc dot gnu.org
2021-03-05 16:43 ` ppalka at gcc dot gnu.org
2021-03-06  5:08 ` cvs-commit at gcc dot gnu.org
2021-03-06 15:26 ` 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).