  
  	if(sys_has_sse4_2())
  	{
-diff --git a/src/FileScanner.h b/src/FileScanner.h
-index dbfa698e19f499cc1341bdc14ca2d3c77ac38917..547bbfef7c9910ff92e036b3e8a6a2f2f6814a38 100644
---- a/src/FileScanner.h
-+++ b/src/FileScanner.h
-@@ -157,11 +157,11 @@ class FileScanner
+diff -pur universalcodegrep-0.3.3-old/src/FileScanner.h universalcodegrep-0.3.3/src/FileScanner.h
+--- universalcodegrep-0.3.3-old/src/FileScanner.h	2016-12-30 16:38:24.000000000 +0100
++++ universalcodegrep-0.3.3/src/FileScanner.h	2018-03-13 20:26:32.000000000 +0100
+@@ -145,17 +145,14 @@ protected:
  	const char * find_sse4_2_popcnt(const char * __restrict__ cbegin, size_t len) const noexcept;
  
  
--	using LiteralMatch_type = std::function<int (const FileScanner *obj, const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept>;
-+	//using LiteralMatch_type = std::function<int (const FileScanner *obj, const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept>;
+-	using LiteralMatch_type = std::function<int (FileScanner *obj, const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept>;
+-
+-	static LiteralMatch_type resolve_LiteralMatch(FileScanner *obj) noexcept;
+-
+-	LiteralMatch_type LiteralMatch;
 +	int (FileScanner::*LiteralMatch)(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
 +	static decltype(LiteralMatch) resolve_LiteralMatch(FileScanner *obj) noexcept;
  
--	static LiteralMatch_type resolve_LiteralMatch(FileScanner *obj) noexcept;
--
--	LiteralMatch_type LiteralMatch;
-+	//LiteralMatch_type LiteralMatch noexcept;
- 
  	//int (*FileScanner::LiteralMatch)(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
  
-diff --git a/src/FileScannerPCRE2.cpp b/src/FileScannerPCRE2.cpp
-index fc95d95d732781ae83d0c8c6919f2d870e7528eb..04426e8cd51c44150cf3eb79d05d5b11d4a4b6a3 100644
---- a/src/FileScannerPCRE2.cpp
-+++ b/src/FileScannerPCRE2.cpp
-@@ -361,7 +361,8 @@ void FileScannerPCRE2::ScanFile(const char* __restrict__ file_data, size_t file_
- 			{
- 				PCRE2_SIZE old_ovector[2] = { ovector[0], ovector[1] };
- 				// Find the literal prefix.
--				rc = LiteralMatch(this, file_data, file_size, start_offset, ovector);
-+				/// @todo std::invoke from C++17 might be better here.
-+				rc = (this->*LiteralMatch)(file_data, file_size, start_offset, ovector);
- 				if(ovector[0] > file_size)
- 				{
- 					break;
-@@ -425,7 +426,7 @@ void FileScannerPCRE2::ScanFile(const char* __restrict__ file_data, size_t file_
+-	int LiteralMatch_default(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept;
++	int LiteralMatch_default(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
+ 
+-	int LiteralMatch_sse4_2(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept;
++	int LiteralMatch_sse4_2(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
+ 
+ 	///@}
+ 
+diff -pur universalcodegrep-0.3.3-old/src/FileScannerPCRE2.cpp universalcodegrep-0.3.3/src/FileScannerPCRE2.cpp
+--- universalcodegrep-0.3.3-old/src/FileScannerPCRE2.cpp	2016-12-30 16:38:24.000000000 +0100
++++ universalcodegrep-0.3.3/src/FileScannerPCRE2.cpp	2018-03-13 20:20:26.000000000 +0100
+@@ -356,7 +356,7 @@ void FileScannerPCRE2::ScanFile(const ch
  		}
  		else
  		{

 		}
 
 		// Check for no match.

From 5a22727f20f132e3db52ea4f64f8b42ce0485a3f Mon Sep 17 00:00:00 2001
From: "Gary R. Van Sickle" <grvs@users.sourceforge.net>
Date: Sat, 13 May 2017 17:36:53 -0500
Subject: [PATCH 8/9] Cleanup.

---
 src/FileScanner.h        | 27 +++++++++++++++++++--------
 src/FileScannerPCRE2.cpp |  1 +
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/FileScanner.h b/src/FileScanner.h
index 547bbfef7c9910ff92e036b3e8a6a2f2f6814a38..1966918b77e7ce5237aecb46d5c18feb25389ae6 100644
--- a/src/FileScanner.h
+++ b/src/FileScanner.h
@@ -156,14 +156,21 @@ class FileScanner
 	const char * find_sse4_2_no_popcnt(const char * __restrict__ cbegin, size_t len) const noexcept;
 	const char * find_sse4_2_popcnt(const char * __restrict__ cbegin, size_t len) const noexcept;
 
-
-	//using LiteralMatch_type = std::function<int (const FileScanner *obj, const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept>;
+	/**
+	 * Member function pointer to the multiversioned LiteralMatch function.
+	 *
+	 * @param file_data
+	 * @param file_size
+	 * @param start_offset
+	 * @param ovector
+	 * @return
+	 */
 	int (FileScanner::*LiteralMatch)(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
-	static decltype(LiteralMatch) resolve_LiteralMatch(FileScanner *obj) noexcept;
-
-	//LiteralMatch_type LiteralMatch noexcept;
 
-	//int (*FileScanner::LiteralMatch)(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
+	/**
+	 * Runtime resolver function for the LiteralMatch function.
+	 */
+	static decltype(LiteralMatch) resolve_LiteralMatch(FileScanner *obj) noexcept;
 
 	int LiteralMatch_default(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept;
 
@@ -172,9 +179,9 @@ class FileScanner
 	///@}
 
 	/**
-	 * Analyzes the given #regex and returns true if it's a literal string.
+	 * Analyzes the given @c regex and returns true if it's a literal string.
 	 *
-	 * @returns  true if regex is literal.
+	 * @returns  true if @c regex is literal.
 	 */
 	bool IsPatternLiteral(const std::string &regex) const noexcept;
 
@@ -207,6 +214,10 @@ class FileScanner
 	/// One past the end of the last valid value in m_compiled_range_bitmap.
 	uint16_t m_end_ranges_table {0};
 
+	/**
+	 * The literal string to search for.  This string has been allocated by overaligned_alloc(), and so must be
+	 * deallocated by std::free().  We package it up in a std::unique_ptr<> with a custom deleter to prevent leaks.
+	 */
 	std::unique_ptr<uint8_t,void(*)(void*)> m_literal_search_string { nullptr, std::free };
 	size_t m_literal_search_string_len {0};
 
diff --git a/src/FileScannerPCRE2.cpp b/src/FileScannerPCRE2.cpp
index 04426e8cd51c44150cf3eb79d05d5b11d4a4b6a3..b00e1bc65d5700d40167e1317cadec4da9f844d7 100644
--- a/src/FileScannerPCRE2.cpp
+++ b/src/FileScannerPCRE2.cpp
@@ -426,6 +426,7 @@ void FileScannerPCRE2::ScanFile(const char* __restrict__ file_data, size_t file_
 		}
 		else
 		{
+			/// @todo std::invoke from C++17 might be better here.
 			rc = (this->*LiteralMatch)(file_data, file_size, start_offset, ovector);
 		}
 

From 854e497024edc4657ad1303d5473664851b0855a Mon Sep 17 00:00:00 2001
From: "Gary R. Van Sickle" <grvs@users.sourceforge.net>
Date: Sat, 13 May 2017 18:03:03 -0500
Subject: [PATCH 9/9] Updated News.md for #118.

---
 NEWS.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS.md b/NEWS.md
index 11eb04c68cdc605e0aa296013023f4f9b2645519..930211241bfb904a59d933dc7111c8d1ac3d353e 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,7 +8,7 @@
 - Removed dependency on GNU argp.  Now using [The Lean Mean C++ Option Parser](http://optionparser.sourceforge.net/), included in `ucg` distro, for option parsing.
 
 ### Fixed
-
+- Resolved issue with std::function<> vs. noexcept breaking build under Clang 4.0.0.  Resolves #118.
 
 ## [0.3.3] - 2016-12-30
 

diff -pur universalcodegrep-0.3.3-old/src/FileScanner.cpp universalcodegrep-0.3.3/src/FileScanner.cpp
--- universalcodegrep-0.3.3-old/src/FileScanner.cpp	2016-12-30 16:38:24.000000000 +0100
+++ universalcodegrep-0.3.3/src/FileScanner.cpp	2018-03-13 20:29:31.000000000 +0100
@@ -246,7 +246,7 @@ bool FileScanner::IsPatternLiteral(const
 	return is_lit;
 }
 
-int FileScanner::LiteralMatch_default(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) noexcept
+int FileScanner::LiteralMatch_default(const char *file_data, size_t file_size, size_t start_offset, size_t *ovector) const noexcept
 {
 	int rc = 0;
 
@@ -283,10 +283,6 @@ extern "C" void * resolve_CountLinesSinc
 	{
 		retval = reinterpret_cast<void*>(&FileScanner::CountLinesSinceLastMatch_sse4_2_no_popcnt);
 	}
-	else if(sys_has_sse2())
-	{
-		retval = reinterpret_cast<void*>(&FileScanner::CountLinesSinceLastMatch_sse2);
-	}
 	else
 	{
 		retval = reinterpret_cast<void*>(&FileScanner::CountLinesSinceLastMatch_default);
@@ -295,9 +291,9 @@ extern "C" void * resolve_CountLinesSinc
 	return retval;
 }
 
-FileScanner::LiteralMatch_type FileScanner::resolve_LiteralMatch(FileScanner * obj [[maybe_unused]]) noexcept
+decltype(FileScanner::LiteralMatch) FileScanner::resolve_LiteralMatch(FileScanner * obj [[maybe_unused]]) noexcept
 {
