[LLVMbugs] [Bug 20496] New: No diagnostic for address of bit-field result of pre-increment operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 30 16:09:16 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20496

            Bug ID: 20496
           Summary: No diagnostic for address of bit-field result of
                    pre-increment operator
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

N3290 subclause 5.3.2 [expr.pre.incr] paragraph 1 indicates that the result of
the prefix increment is a bit-field in the source below.

N3290 subclause 5.3.1 [expr.unary.op] paragraph 5 states that the operand of &
shall not be a bit-field.

### SOURCE:
$ cat addrBit.cc 
struct S { int a : 1; } s;
int *p = &++s.a;


### COMPILER INVOCATION AND OUTPUT:
$ clang++ -cc1 -std=c++11 -pedantic-errors -Wall -Wextra addrBit.cc; echo rc=$?
rc=0


### EXPECTED OUTPUT:
addrBit.cc:2:10: error: address of bit-field requested
int *p = &++s.a;
         ^  ~~~
1 error generated.
rc=1


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.5.0 (trunk 214060)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140730/d76d1650/attachment.html>


More information about the llvm-bugs mailing list