This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36261] New: Static const member data not found when used in a template
- From: "Bernd dot Donner at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2008 22:20:32 -0000
- Subject: [Bug c++/36261] New: Static const member data not found when used in a template
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This small program cannot be compiled. It failes with an "undefined reference
to `A::N'" error. Replacing the main function line with:
std::cout << "Number: " << std::min(1, (int)A::N) << "\n";
results in a successful compilation.
This is the small program to reproduce the bug:
#include <iostream>
#include <algorithm>
struct A {
static const int N = 2;
};
int main ()
{
std::cout << "Number: " << std::min(1, A::N) << "\n";
}
--
Summary: Static const member data not found when used in a
template
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Bernd dot Donner at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36261