This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82047] non-existent variable template used to initialize variable


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

--- Comment #7 from Louis Dionne <ldionne.2 at gmail dot com> ---
Then, I think there's another bug in GCC (or maybe just a QOI issue), since the
following code compiles (wandbox[1]):

  template <typename T> constexpr T v;
  template <typename T> constexpr T v(888);

  struct S {
    constexpr S() : value(999) { }
    constexpr S(int x) : value(x) { }
    int value;
  };

  static_assert(v<S>.value == 888);


Instead, I would expect to get some error saying that I'm redefining `v` on the
second line. FWIW, Clang does think it's only a declaration [2].


[1]: https://wandbox.org/permlink/c5An5PbMbJdxa9Hj
[2]: https://wandbox.org/permlink/m9VSksjjtFhiQSab

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]