The following code that puts two static variables into their own section won't
compile because of a section type conflict.

class C
{
public:
  void m()
  {
    static const int TWO __attribute__((section(".consts"))) = 2;
  }
}; 

static void c()
{
  static const int ONE __attribute__((section(".consts"))) = 1;
}

int
main (int argc, char **argv)
{
  C inst = C();
  inst.m();
  c();
  return 0;
}

$ g++ section.cxx 
section.cxx:12: error: ONE causes a section type conflict

The section should have the same type in both definitions, but apparently
doesn't.


-- 
           Summary: Using section attribute in c and c++ function causes
                    section type conflict
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at gcc dot gnu dot org


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

Reply via email to