[llvm-bugs] [Bug 18874] constexpr function ill-formed but error message incorrect

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 2 03:50:39 PDT 2017


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

NODA, Kai <nodakai at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nodakai at gmail.com
         Resolution|---                         |FIXED

--- Comment #3 from NODA, Kai <nodakai at gmail.com> ---
As of today, clang trunk at 306691 seems to be producing satisfactory results:

/tmp/i.cpp:17:15: error: constexpr function never produces a constant
expression [-Winvalid-constexpr]
constexpr int func2() {
              ^
/tmp/i.cpp:18:17: note: non-constexpr constructor 'test' cannot be used in a
constant expression
    test<int,3> test1 ;
                ^
/tmp/i.cpp:4:8: note: declared here
struct test
       ^
/tmp/i.cpp:27:19: error: constexpr variable 'x' must be initialized by a
constant expression
    constexpr int x = func<int>();
                  ^   ~~~~~~~~~~~
/tmp/i.cpp:11:15: note: non-constexpr constructor 'test' cannot be used in a
constant expression
    test<T,3> test1 ;
              ^
/tmp/i.cpp:27:23: note: in call to 'func()'
    constexpr int x = func<int>();
                      ^
/tmp/i.cpp:4:8: note: declared here
struct test
       ^
2 errors generated.

-- 
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/20170702/ea9fc739/attachment.html>


More information about the llvm-bugs mailing list