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

            Bug ID: 84255
           Summary: accepts redefinition of template variable
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: smw at gcc dot gnu.org
  Target Milestone: ---

The following code is accepted by all version of GCC tested, but rejected by
other compilers following ISO/IEC 14889 [temp]/1.

    template<typename T>
        constexpr T pi = T(3.1415926535897932385);

    template<typename T>
        constexpr T pi = T(3.1415926535897932385);

I would expect a diagnostic similar to the one from the LLVM compiler:

<source>:5:21: error: redefinition of 'pi'
        constexpr T pi = T(3.1415926535897932385);
                    ^
<source>:2:21: note: previous definition is here
        constexpr T pi = T(3.1415926535897932385);

Reply via email to