This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/83342] extern marked variable template with later definition emits error
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 27 Jan 2018 01:11:05 +0000
- Subject: [Bug c++/83342] extern marked variable template with later definition emits error
- Auto-submitted: auto-generated
- References: <bug-83342-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83342
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-27
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |7.2.0, 8.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with the following simplified test case. As noted, other compilers
including Clang, EDG eccp 4.13, ICC 18, and MSVC accept the code.
$ cat t.C && gcc -O2 -S -Wall t.C
template <typename T>
extern const int N;
template <typename T>
const int N = sizeof(T);
template const int N<int>;
t.C: In instantiation of ‘const int N<int>’:
t.C:7:20: required from here
t.C:7:20: error: explicit instantiation of ‘N<int>’ but no definition available
[-fpermissive]
template const int N<int>;
^~~~~~