[llvm-bugs] [Bug 37739] New: Clang compiler failed with error for the test with sum of variables declared with "constexpr __attribute__((vector_size()))"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 7 13:01:46 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37739

            Bug ID: 37739
           Summary: Clang compiler failed with error for the test with sum
                    of variables declared with "constexpr
                    __attribute__((vector_size()))"
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: soumi.manna at intel.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

-bash-4.2$ clang  -c -std=c++11 test.cpp
test.cpp:3:21: error: constexpr variable 's' must be initialized by a constant
expression
constexpr vec s = v + v;
                  ~~^~~
1 error generated.

-bash-4.2$ cat test.cpp
typedef long vec __attribute__((vector_size (2 * sizeof (long))));
constexpr vec v = { 3, 4 };
constexpr vec s = v + v;


Clang doesn't consider sum of two variables of type "constexpr long
__attribute__((vector_size (2 * sizeof (long))))" as constant expression. 

If I change "constexpr vec s" to just "vec s" this test will pass. 

GCC compiles the test without any error.

-- 
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/20180607/45c10dbb/attachment.html>


More information about the llvm-bugs mailing list