Hi,

the following code fails to compile under MinGW (GCC 4) as well as Ubuntu Linux
(GCC 4) although it is syntactically correct:




template <bool respectFiltering>
class DetectChanges
{
public:
    template <int side>
    void detectFileChange() const {}
};

class RedetermineAuto
{
public:
    RedetermineAuto()
    {
        execute(DetectChanges<false>());
    }

private:
    template <bool dbLeftFilterActive>
    static void execute(DetectChanges<dbLeftFilterActive> dbLeft)
    {
        dbLeft.detectFileChange<3>();
    }
};


int main()
{
    return 0;
}


Compiler messages:
C:\Programme\C++\Projects\test\main.cpp|25|error: expected primary-expression
before ')' token|
C:\Programme\C++\Projects\test\main.cpp|18|instantiated from here|
C:\Programme\C++\Projects\test\main.cpp|25|error: invalid operands of types
'<unresolved overloaded function type>' and 'int' to binary 'operator<'|
||=== Build finished: 2 errors, 0 warnings ===|




If the unrelated statement "template <int> void detectFileChange();" is
inserted at the top, the code compiles which is very strange.

Regards, ZenJu


-- 
           Summary: Compilation error with member templates
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zhnmju123 at gmx dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41614

Reply via email to