This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41614] New: Compilation error with member templates
- From: "zhnmju123 at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2009 21:11:03 -0000
- Subject: [Bug c++/41614] New: Compilation error with member templates
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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