[cfe-users] clang++-3.3 reject valid ?
Дмитрий Дьяченко
dimhen at gmail.com
Thu Apr 11 08:51:19 PDT 2013
Hi!
The following code
$ cat -n x.ii
1 extern "C" typedef struct
2 {
3 volatile struct
4 {
5 } fields;
6 }
7 CSPHandleState;
8 typedef struct
9 {
10 CSPHandleState state;
11 }
12 CSPHandle;
13 CSPHandle a;
14 void
15 fn1 ()
16 {
17 CSPHandleState b;
18 b = a.state;
19 }
rejected by clang++
$ /home/dimhen/build/csa/Release+Asserts/bin/clang++ -fsyntax-only -x c++ x.ii
x.ii:1:20: error: member function 'operator=' not viable: 'this'
argument has type
'volatile struct <anonymous struct at x.ii:3:14>', but function
is not marked
volatile
extern "C" typedef struct
^~~~~~
x.ii:3:14: note: 'operator=' declared here
volatile struct
^
x.ii:18:7: note: implicit default copy assignment operator for
'CSPHandleState' first
required here
b = a.state;
^
1 error generated.
$ /home/dimhen/build/csa/Release+Asserts/bin/clang++ -v
clang version 3.3 (trunk 179273)
Target: x86_64-unknown-linux-gnu
Thread model: posix
but gcc accept this
$ g++ -Wall -Wextra -fsyntax-only x.ii
[dimhen at dim clang]$ echo $?
0
gcc versions:
gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) (GCC)
gcc version 4.9.0 20130411 (experimental) [trunk revision 197693] (GCC)
Original file (not the reduced testcase) was successfully compiled with
many gcc versions (many versions from 3.2.3 to 4.9), xlc (AIX 5/6/7),
suncc (Solaris 9/10 x64/sparc), MS Visual Studio (many versions from
2005 to 2012)
So, my question is: what is right behavior?
Thank You,
Dmitry
More information about the cfe-users
mailing list