public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55159] pythy constexpr auto lambda pointer has no initializer Date: Thu, 01 Nov 2012 10:58:00 -0000 [thread overview] Message-ID: <bug-55159-4-R7wn25s9NW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55159-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55159 Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler at | |googlemail dot com --- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-11-01 10:58:06 UTC --- I really think that Pythy should fix this implementation, because it is not supported by the C++11 standard. Any compiler accepting that is defect. According to 9.4.2 p3: "A static data member of literal type can be declared in the class definition with the constexpr specifier; if so, its declaration shall specify a brace-or-equal-initializer in which every initializer-clause that is an assignment-expression is a constant expression." As of 5.19 p2 the appearance of a lambda-expression prevents an expression from satisfying the requirements of a (core) constant expression. But changing your example to template <typename T> T* addr(T& t) { return &t; } bool less(int x, int y) { return x < y ? x : y; } const static auto* f = addr(less); indeed points to a defect of gcc, not being able to deduce auto here. I think this is the same bug that I can remember (but cannot find at the very moment) which shows a similar problem during overload resolution in templates when involving function addresses such as in template <typename T> T* addr(T& t) { return &t; } bool less(int x, int y) { return x < y ? x : y; } template<typename T> int deduce(const T*) { return 0; } int i = deduce(addr(less)); This example should be accepted, but gcc doesn't like it saying: "error: no matching function for call to 'deduce(bool (*)(int, int))'| note: candidate is:| note: template<class T> int deduce(const T*)| note: template argument deduction/substitution failed:| note: types 'const T' and 'bool(int, int)' have incompatible cv-qualifiers"
next prev parent reply other threads:[~2012-11-01 10:58 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-01 0:33 [Bug c++/55159] New: " supercilious.dude at gmail dot com 2012-11-01 10:58 ` daniel.kruegler at googlemail dot com [this message] 2012-11-01 14:26 ` [Bug c++/55159] " paolo.carlini at oracle dot com 2012-11-01 15:12 ` daniel.kruegler at googlemail dot com 2012-11-02 8:10 ` daniel.kruegler at googlemail dot com 2012-11-02 8:57 ` daniel.kruegler at googlemail dot com 2012-11-02 11:15 ` paolo.carlini at oracle dot com 2012-11-02 11:39 ` daniel.kruegler at googlemail dot com 2012-11-02 11:49 ` paolo.carlini at oracle dot com 2012-11-07 15:42 ` paolo.carlini at oracle dot com 2012-11-07 16:12 ` paolo.carlini at oracle dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-55159-4-R7wn25s9NW@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).