[llvm-bugs] [Bug 37298] New: support for GCC complex data types extension is always enabled.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 30 18:11:30 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37298
Bug ID: 37298
Summary: support for GCC complex data types extension is always
enabled.
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: konstantin.belochapka at sony.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Created attachment 20251
--> https://bugs.llvm.org/attachment.cgi?id=20251&action=edit
reprodicible
clang with -std=c++11 option does not disable support for GCC complex data
types extensions.
-------------------------------------------------------------------------------
Compile the attached source with -std=c++14:
$clang -c -std=c++11 gcc-complex-data-extension.cpp
This produces no warnings or errors.
--------------------------------------------------------------------------------
GCC with -std=c++14 option produces the following error messages:
$gcc -c -std=c++14 gcc-complex-data-extension.cpp
gcc-complex-data-extension.cpp: In function 'int test()':
gcc-complex-data-extension.cpp:25:20: error: unable to find numeric literal
operator 'operator""i'
cshort_t cs = 2 + 2i;
^
.....
gcc-complex-data-extension.cpp:31:24: note: use -std=gnu++11 or
-fext-numeric-literals to enable
more built-in suffixes
gcc-complex-data-extension.cpp:32:26: error: unable to find numeric literal
operator 'operator""fi'
cldouble_t cld = 8.0f + 2.1fi;
^
gcc-complex-data-extension.cpp:32:26: note: use -std=gnu++11 or
-fext-numeric-literals to enable
more built-in suffixes
--------------------------------------------------------------------------------
After adding -pedantic, we can observe the following list of warnings:
$clang -c -std=c++11 -pedantic gcc-complex-data-extension.cpp
Produces the following:
gcc-complex-data-extension.cpp:25:20: warning: imaginary constants are a GNU
extension
[-Wgnu-imaginary-constant]
cshort_t cs = 2 + 2i;
^
...... ^
gcc-complex-data-extension.cpp:32:26: warning: imaginary constants are a GNU
extension
[-Wgnu-imaginary-constant]
cldouble_t cld = 8.0f + 2.1fi;
$clang -c -std=gnu++11 -pedantic gcc-complex-data-extension.cpp
Produces identical list of warnings.
Conclusion:
Unlike GCC, clang when used with -std=c++11 option, does not disable GCC
complex data types extension support.
--
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/20180501/359389fe/attachment.html>
More information about the llvm-bugs
mailing list