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++/54483] New: undefined reference to static constexpr in .so


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

             Bug #: 54483
           Summary: undefined reference to static constexpr in .so
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: baliga@gmail.com


In a.hh 
---------

class A {
  static constexpr float val = 0.08;

  public:
   bool foo(const float v);
};


In a.cc
--------

bool A::foo(const float v) {
  return (v < -val);
}

Created a libfoo.so from the above code and linked this .so with another
executable using A::foo(const float) method.

Creating an executable result in "undefined reference to A::val"

If I replace val with -0.08 and change foo method with return (v < val), val is
getting inlined.


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