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

            Bug ID: 71875
           Summary: template specialization compile error
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liweifriends at gmail dot com
  Target Milestone: ---

Created attachment 38899
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38899&action=edit
the code

The code is as follows:

template <typename T>
constexpr bool IsMatrix = false;

// matrices
template<typename TElem>
class Matrix {};

template <typename TElem>
constexpr bool IsMatrix<Matrix<TElem>> = true;

// Row-vector expanded matrix
template<typename TNestVec>
class RowVecExpMatrix;

template <typename TNestVec>
constexpr bool IsMatrix<RowVecExpMatrix<TNestVec>> = true;

int main()
{
    static_assert(IsMatrix<RowVecExpMatrix<Matrix<int>>>, "Matrix check
error");
    static_assert(IsMatrix<Matrix<int>>, "Input type is not a matrix");
}

The Compile command is as follows: 
g++ --std=c++14 ./main.cpp 

When using gcc 5.4.0 or 6.1.1, the compiler complains as follows:
Error: symbol `_ZL8IsMatrix' is already defined

When using gcc 5.2 or 5.3, the code can be compiled with no error output.

Reply via email to