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

            Bug ID: 114267
           Summary: bogus -Wsubobject-linkage when using lambda members as
                    template parameters
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brunopitrus at hotmail dot com
  Target Milestone: ---

header.h:
```
struct F{
        constexpr static const auto algorithm=[]() {};
};

constexpr inline const auto algorithm=[]() {};


template<auto algo> struct G{};

struct S{
        G<algorithm> foo; //ok
        G<F::algorithm> lol; //Wsubobject-linkage
};
```

main.cpp:
//can be empty

See it on godbolt:
https://godbolt.org/z/qccjfTPnr

The behavior is inconsistent between the lambda declared as a member and as a
non-member. Moreover, if i compile this code with -O0, the resultant object has
a ‘r’ private symbol for F::algorithm, which makes me suspect that wrong code
is being generated.
  • [Bug c++/114267] New: bogus -W... brunopitrus at hotmail dot com via Gcc-bugs

Reply via email to