public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67185] New: [concepts] Link error on ODR-use of constexpr constrained variable template partial specialization
@ 2015-08-11 17:57 Casey at Carter dot net
0 siblings, 0 replies; only message in thread
From: Casey at Carter dot net @ 2015-08-11 17:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67185
Bug ID: 67185
Summary: [concepts] Link error on ODR-use of constexpr
constrained variable template partial specialization
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
Created attachment 36170
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36170&action=edit
Test case
r226750 compiles this program compiles correctly:
template <class T>
concept bool C = false;
template <class>
constexpr bool trait = false;
template <C T>
constexpr bool trait<T> = true;
const bool& f() { return trait<int>; }
int main() {}
since it uses the base template, but not this one:
template <class T>
concept bool C = true;
template <class>
constexpr bool trait = false;
template <C T>
constexpr bool trait<T> = true;
const bool& f() { return trait<int>; }
int main() {}
The error is:
~/gcc6-r226750/bin/g++ -std=gnu++1z foo2.cpp
/tmp/ccfAOK5N.o: In function `f()':
foo2.cpp:(.text+0x5): undefined reference to `trait'
collect2: error: ld returned 1 exit status
Inspection of the assembly output (target is Linux x64) shows that the first
program uses the symbol "_Z5traitIiE" for "trait<int>" and the second the
symbol "_ZL5trait". I suspect this discrepancy is the crux of the problem.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-11 17:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-11 17:57 [Bug c++/67185] New: [concepts] Link error on ODR-use of constexpr constrained variable template partial specialization Casey at Carter dot net
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).