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

             Bug #: 53628
           Summary: [C++11][DR 712] Compiler requires definition of static
                    member constants when not odr-used
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com


The following example leads to a linker error when compiled in C++11 mode using
gcc 4.8.0 20120603 (experimental):

//---
struct S
{
  static const int a = 1;
  static const int b = 2;
};

int main(int argc, char** argv)
{
  return argc > 1 ? S::a : S::b;
}
//---

"8|undefined reference to `S::a'|
8|undefined reference to `S::b'"

This example is now valid with the acceptance of

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712

and should no longer require a definition of either S::a or S::b.

Reply via email to