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++/83342] extern marked variable template with later definition emits error


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>;
                    ^~~~~~

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