public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108242] New: '__FUNCTION__' was not declared when used inside a lambda declared inside a template function
@ 2022-12-28 16:13 n.eugene536 at gmail dot com
  2022-12-28 17:50 ` [Bug c++/108242] '__FUNCTION__' was not declared when used inside a generic (templated) " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: n.eugene536 at gmail dot com @ 2022-12-28 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108242
           Summary: '__FUNCTION__' was not declared when used inside a
                    lambda declared inside a template function
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: n.eugene536 at gmail dot com
  Target Milestone: ---

Target: x86_64-linux-gnu
Broken since gcc 12.1; works fine with gcc <= 11.3

g++ a.cpp -std=c++14

template<class F>
void my_fun()
{
    auto fun = [&](auto res) {
        static constexpr char const* fun_name = __FUNCTION__;
        struct
        {
            constexpr const char* operator()() const { return fun_name; };
        } t;
        t();
    };

    fun(12);
}


int main() {
    my_fun<int>();
}


output: Compilation error
source>:8:63: error: '__FUNCTION__' was not declared in this scope
    8 |             constexpr const char* operator()() const { return fun_name;
};


expected: successful compilation

Works perfectly fine with clang

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

end of thread, other threads:[~2023-07-07 10:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28 16:13 [Bug c++/108242] New: '__FUNCTION__' was not declared when used inside a lambda declared inside a template function n.eugene536 at gmail dot com
2022-12-28 17:50 ` [Bug c++/108242] '__FUNCTION__' was not declared when used inside a generic (templated) " pinskia at gcc dot gnu.org
2022-12-28 17:54 ` [Bug c++/108242] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-12-29  2:44 ` pinskia at gcc dot gnu.org
2023-01-02  9:27 ` jakub at gcc dot gnu.org
2023-01-09 14:03 ` rguenth at gcc dot gnu.org
2023-02-03 18:09 ` jakub at gcc dot gnu.org
2023-02-03 18:16 ` mpolacek at gcc dot gnu.org
2023-02-03 18:23 ` jakub at gcc dot gnu.org
2023-03-16 19:15 ` jason at gcc dot gnu.org
2023-03-16 22:11 ` cvs-commit at gcc dot gnu.org
2023-04-18 20:46 ` [Bug c++/108242] [10/11/12 " cvs-commit at gcc dot gnu.org
2023-07-07 10:44 ` [Bug c++/108242] [11 " rguenth 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).