public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114163] New: Calling member function of an incomplete type compiles in gcc and does not compile in clang and msvc
@ 2024-02-29  9:23 jlame646 at gmail dot com
  2024-02-29 11:59 ` [Bug c++/114163] " harald at gigawatt dot nl
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jlame646 at gmail dot com @ 2024-02-29  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114163
           Summary: Calling member function of an incomplete type compiles
                    in gcc and does not compile in clang and msvc
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following invalid program(since lambda's body in not complete class
context) is compiled by gcc:

```
struct TestClass {
  void testFinction() {}
  static TestClass* ptr_;
  constexpr static auto funcPtr = +[](){ ptr_->testFinction(); };
};

TestClass* TestClass::ptr_ = new TestClass();

int main() {
//   TestClass::funcPtr();
//   delete TestClass::ptr_;
  return 0;
}
```
Demo https://godbolt.org/z/Yhc8MeWW6

First discovered at
https://stackoverflow.com/questions/78080083/calling-member-function-of-an-incomplete-type-compiles-in-gcc-and-does-not-compi

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

end of thread, other threads:[~2024-02-29 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29  9:23 [Bug c++/114163] New: Calling member function of an incomplete type compiles in gcc and does not compile in clang and msvc jlame646 at gmail dot com
2024-02-29 11:59 ` [Bug c++/114163] " harald at gigawatt dot nl
2024-02-29 12:13 ` de34 at live dot cn
2024-02-29 12:15 ` jakub 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).