This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36261] New: Static const member data not found when used in a template


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]