This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82047] non-existent variable template used to initialize variable
- From: "ldionne.2 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Aug 2017 17:00:42 +0000
- Subject: [Bug c++/82047] non-existent variable template used to initialize variable
- Auto-submitted: auto-generated
- References: <bug-82047-4@http.gcc.gnu.org/bugzilla/>
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