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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to