[cfe-commits] [PATCH] --std=gnu++0xc9x : Allowing C++0x, C99 and GNU extensions
Benoit Belley
Benoit.Belley at autodesk.com
Fri Sep 3 05:13:13 PDT 2010
Without the C99 language features, I trigger the following error message:
// C99 variable-length arrays
def err_vla_non_pod : Error<"variable length array of non-POD element type %0 »>;
Note that both g++ and the Intel compiler accept C99 VLA by default. Here’s an example demonstrating this:
$ car foo.cpp
class A
{
public:
A();
~A();
};
void foo(int i)
{
A vla[i];
}
$ clang++ -c foo.cpp
foo.cpp:10:10: error: variable length array of non-POD element type 'A'
A vla[i];
^
1 error generated.
$ g++ -c foo.cpp
$ icpc -c foo.cpp
Here’s more info about the various compiler versions:
$ clang++ -v
clang version 2.8 (trunk)
Target: x86_64-apple-darwin10
Thread model: posix
Revision: 112699
$ g++ -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
$ icpc -v
Version 12.0.0
Benoit
Le 2010-09-02 à 21:37, Eli Friedman a écrit :
On Thu, Sep 2, 2010 at 3:31 PM, Benoit Belley
<Benoit.Belley at autodesk.com<mailto:Benoit.Belley at autodesk.com>> wrote:
Hi Everyone
To compile my application, I need to enable both the C++0x and C99 language features along with the GNU extensions (yes, I know this seems crazy but it is true!). Previously, that was not possible with Clang. The following patch makes that possible by adding the command-line options : --std=gnu++0xc9x.
What exactly do you need that is not part of gnu++0x? We don't really
want to deviate from gcc here unless there's a compelling reason.
-Eli
Benoit Belley
Sr Principal Developer
M&E-Product Development Group
Autodesk Canada Inc.
10 Rue Duke
Montreal, Quebec H3C 2L7
Canada
Direct 514 954-7154
[cid:image002.gif at 01CAF376.C0A99470]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 651 bytes
Desc: image002.gif
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100903/b3cff67b/attachment.gif>
More information about the cfe-commits
mailing list