[LLVMbugs] [Bug 19385] New: Adding static_asserts suppresses errors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 9 10:01:52 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19385

            Bug ID: 19385
           Summary: Adding static_asserts suppresses errors
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jw2wjw2 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12359
  --> http://llvm.org/bugs/attachment.cgi?id=12359&action=edit
File demonstrating the bug

This program fails to compile with the error:
%%%%   clang++ -std=c++11 static_assert.cpp  %%%%
static_assert.cpp:17:38: error: no matching function for call to 'memoize'
        std::cout << "1+" << val <<" = " << memoize<decltype(&increment),
int>(increment,std::move(val)) << std::endl;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static_assert.cpp:6:1: note: candidate template ignored: substitution failure
[with function_t = int (*)(int), Args = <int>]: implicit instantiation of
undefined template 'std::result_of<int (*(int))(int)>'
memoize(function_t f, Args&&...a) {
^

When the debug flag is enabled, compilation succeeds. (clang++ -std=c++11
-DDEBUG static_assert.cpp)

Since the only difference between the two is the presence of a static_assert,
this violates ยง7.0.4: "... If the value of the expression when so converted is
true, the declaration has no effect."

-- 
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/20140409/f04ad14e/attachment.html>


More information about the llvm-bugs mailing list