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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to