[LLVMbugs] [Bug 24211] New: candidate template ignored: substitution failure(error with clang but not with g++)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 22 06:38:06 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24211

            Bug ID: 24211
           Summary: candidate template ignored: substitution failure(error
                    with clang but not with g++)
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: 1532708160 at qq.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

// g++ compiles the next code, but clang++ not

template<int dim, int loop>  
class Reference{
public:
   //...
   template<int r, int c> using matrix_t = int[r][c];
   Reference(const matrix_t<dim, loop> &mat){}
}; 

template<int dim, int loop>
class Partition{
    // ...
public:
    // ...
    template<int r, int c> using matrix = int[r][c];
    template<int r, int c> void readPattern(const matrix<r,c> &pattern)
    {
       // ...
    }
    // ...
};
int main()
{
   // ... 
   const int DENOISE_UR[3][4] = {/*...*/};
   Partition<1,2> partition;
   partition.readPattern(DENOISE_UR);
   // ...
}
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// only move one of the alias template ahead of the two class definition
// g++ compiles the next code, so as clang++

template<int r, int c> using matrix = int[r][c];

template<int dim, int loop>  
class Reference{
public:
   //...
   template<int r, int c> using matrix_t = int[r][c];
   Reference(const matrix_t<dim, loop> &mat){}
}; 

template<int dim, int loop>
class Partition{
    // ...
public:
    // ...

    template<int r, int c> void readPattern(const matrix<r,c> &pattern)
    {
       // ...
    }
    // ...
};
int main()
{
   // ... 
   const int DENOISE_UR[3][4] = {/*...*/};
   Partition<1,2> partition;
   partition.readPattern(DENOISE_UR);
   // ...
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150722/7b60a75f/attachment.html>


More information about the llvm-bugs mailing list