Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Local class + function pointer template argument + noexcept = SEGFAULT #28339

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR28340
Status NEW
Importance P normal
Reported by Mark (turck11@hotmail.com)
Reported on 2016-06-28 02:44:57 -0700
Last modified on 2016-06-28 18:16:44 -0700
Version trunk
Hardware All All
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments test2-2d7555.sh (2067 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 16646
Run script. Couldn't figure out how to add a 2nd attachment, but the
preprocessed output is boring/probably not helpful anyway.

Minimal repro:

template<typename T>
void isNothrowCallableFunPtr() {
  struct NothrowCallableTest {
    T fun;
    NothrowCallableTest() noexcept(noexcept(fun())) {}
  };
}

int main() {
  isNothrowCallableFunPtr<void(*)()>();
  return 0;
}

See it live on the trunk version of clang here, including the output:
http://melpon.org/wandbox/permlink/dZw6IKrnMY1VbKM8

This repros on 3.8, 3.7, 3.6... maybe more. Also on Apple LLVM version 7.3.0
(clang-703.0.31), which is what I attached the preprocessed source and
associated run script from.
Quuxplusone commented 8 years ago

Attached test2-2d7555.sh (2067 bytes, application/octet-stream): Run script. Couldn't figure out how to add a 2nd attachment, but the preprocessed output is boring/probably not helpful anyway.

Quuxplusone commented 8 years ago

FWIW: just realized that the repro/what I was trying to do doesn't actually make sense until C++17 when this paper is implemented: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html

In particular, a function pointer does not know whether or not it is noexcept.