OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.dg/] [abi/] [bitfield2.C] - Rev 12

Compare with Previous | Blame | View Log

// { dg-do run }
// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }

// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>

typedef int Int;
typedef signed int SInt;
typedef unsigned int UInt;

struct A
{
  SInt bitS : 1;        // signed
  UInt bitU : 1;        // unsigned
  Int bit : 1;          // signedness by -f{signed,unsigned}-bitfields
};

int main ()
{
  A a;

  a.bitS = 1;
  a.bitU = 1;
  a.bit = 1;

  if (a.bitS != -1)
    return 1;
  if (a.bitU != 1)
    return 2;
  if (a.bit != -1)
    return 3;

  return 0;
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.