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++/23833] warning: "ignoring packed attribute on unpacked non-POD field" on templates


------- Additional Comments From Dmitry dot Chepel at acronis dot com  2005-09-12 13:46 -------
#include <iostream>  
template<typename D, typename W>
  struct GuidTemplate
  {
    char kk;
    D TimeLow;
    W TimeMid;
    W TimeHiAndVer;
    union
    {
      char ClkSeqAndNodeArray[8];
      long long ClkSeqAndNodeQword;
      struct
      {
        char ClkSeqHiAndVariant;
        char ClkSeqLow;
        char Node[6];
      };
    };
    GuidTemplate() {}
    
  } __attribute__ ((packed));

  typedef GuidTemplate<long, short> LeGuid;

  struct PartitionEntry
  { 
    LeGuid PartitionTypeGuid; // Unique ID that defines the purpose and type of 
this Partition. 
                                // A value of zero defines that this partition 
                             // record is not being used.
    LeGuid UniquePartitionGuid;// GUID that is unique for every partition 
record. Every
                             // partition ever created will have a unique GUID. 
This
                             // GUID must be assigned when the GUID Partition 
Entry
                             // is created. The GUID Partition Entry is created 
when
                             // ever the NumberOfPartitionEntries in the
                             // GUID Partition Table Header is increased to 
include a
                             // larger range of addresses.
    //le_qword StartingLba;    // Starting LBA of the partition defined by this 
record
    ///le_qword EndingLba;      // Ending LBA of the partition defined by this 
record
    //le_qword Attributes;         // All bit EFI Reserved
    //le_word PartitionName[GPT_PARTITION_NAME_LENGTH];  // Human readable 
Unicode string identification
  } __attribute__ ((packed));                                                 

 
int main()
{
  PartitionEntry entry;
  std::cout << "sizeof structute  LeGuid = " << sizeof(LeGuid) << "\n";
  std::cout << "sizeof structute PartitionEntry = " << sizeof(PartitionEntry) << 
"\n";
  return 0;
}


-- 


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


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