public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99901] New: static const class var implemented with constexpr doesn't emit symbols in C++17 mode
@ 2021-04-04  0:37 tellowkrinkle at gmail dot com
  2021-04-06  3:18 ` [Bug c++/99901] [8/9/10/11 Regression] " ppalka at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: tellowkrinkle at gmail dot com @ 2021-04-04  0:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99901
           Summary: static const class var implemented with constexpr
                    doesn't emit symbols in C++17 mode
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tellowkrinkle at gmail dot com
  Target Milestone: ---

The following code fails to output any symbols when compiled with `-std=c++17`:

struct A {
    static const int a;
};
constexpr int A::a = 5;

Godbolt link: https://gcc.godbolt.org/z/13efnK4x4

You can run this in a way that results in a linker error with the following:

a.h:
#pragma once
struct A { static const int a; };

a.cpp:
#include "a.h"
constexpr int A::a = 0;

main.cpp:
#include "a.h"
int main() { return A::a; }

Works fine when compiled with `g++ main.cpp a.cpp`
Fails when compiled with `g++ -std=c++17 main.cpp a.cpp`

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

end of thread, other threads:[~2022-05-13 17:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04  0:37 [Bug c++/99901] New: static const class var implemented with constexpr doesn't emit symbols in C++17 mode tellowkrinkle at gmail dot com
2021-04-06  3:18 ` [Bug c++/99901] [8/9/10/11 Regression] " ppalka at gcc dot gnu.org
2021-04-06  5:19 ` jason at gcc dot gnu.org
2021-04-06 18:30 ` cvs-commit at gcc dot gnu.org
2021-04-06 18:32 ` [Bug c++/99901] [8/9/10 " jason at gcc dot gnu.org
2021-04-30  8:09 ` rguenth at gcc dot gnu.org
2021-05-14  9:54 ` [Bug c++/99901] [9/10 " jakub at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:20 ` rguenth at gcc dot gnu.org
2021-08-06 10:35 ` jakub at gcc dot gnu.org
2021-08-27 23:31 ` [Bug c++/99901] [9 " pinskia at gcc dot gnu.org
2021-08-28  0:09 ` pinskia at gcc dot gnu.org
2022-05-13 17:41 ` cvs-commit at gcc dot gnu.org
2022-05-13 17:49 ` jason 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).