diff --git a/src/libdredd/src/mutate_visitor.cc b/src/libdredd/src/mutate_visitor.cc index 2d17c575..025cbb3b 100644 --- a/src/libdredd/src/mutate_visitor.cc +++ b/src/libdredd/src/mutate_visitor.cc @@ -158,6 +158,12 @@ bool MutateVisitor::TraverseDecl(clang::Decl* decl) { } bool MutateVisitor::TraverseStmt(clang::Stmt* stmt) { + // Do not mutate under a constant expression, since mutation logic is + // inherently non-constant. + if (stmt != nullptr && llvm::dyn_cast(stmt) != nullptr) { + return true; + } + // Add a node to the mutation tree to capture any mutations beneath this // statement. const PushMutationTreeRAII push_mutation_tree(*this); diff --git a/test/single_file/noexcept.cc b/test/single_file/noexcept.cc new file mode 100644 index 00000000..7847adfb --- /dev/null +++ b/test/single_file/noexcept.cc @@ -0,0 +1 @@ +void foo() noexcept(true); diff --git a/test/single_file/noexcept.cc.expected b/test/single_file/noexcept.cc.expected new file mode 100644 index 00000000..7847adfb --- /dev/null +++ b/test/single_file/noexcept.cc.expected @@ -0,0 +1 @@ +void foo() noexcept(true); diff --git a/test/single_file/noexcept.cc.noopt.expected b/test/single_file/noexcept.cc.noopt.expected new file mode 100644 index 00000000..7847adfb --- /dev/null +++ b/test/single_file/noexcept.cc.noopt.expected @@ -0,0 +1 @@ +void foo() noexcept(true);