From 81a8da13ab094902565020484632fbd586c1c798 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 12 Apr 2013 12:21:15 +0100
Subject: [PATCH] ENH: wordRe: disable implicit conversions

---
 src/OpenFOAM/primitives/strings/wordRe/wordRe.H  | 11 +++++++----
 src/OpenFOAM/primitives/strings/wordRe/wordReI.H | 14 +++++++++++++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
index e45044c9975..b0cb62e0b43 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
@@ -120,22 +120,25 @@ public:
         inline wordRe(const wordRe&);
 
         //- Construct from keyType
-        inline wordRe(const keyType&, const compOption=LITERAL);
+        inline explicit wordRe(const keyType&);
+
+        //- Construct from keyType
+        inline wordRe(const keyType&, const compOption);
 
         //- Construct as copy of word
         inline explicit wordRe(const word&);
 
         //- Construct as copy of character array
         //  Optionally specify how it should be treated.
-        inline wordRe(const char*, const compOption = LITERAL);
+        inline explicit wordRe(const char*, const compOption = LITERAL);
 
         //- Construct as copy of string.
         //  Optionally specify how it should be treated.
-        inline wordRe(const string&, const compOption = LITERAL);
+        inline explicit wordRe(const string&, const compOption = LITERAL);
 
         //- Construct as copy of std::string
         //  Optionally specify how it should be treated.
-        inline wordRe(const std::string&, const compOption = LITERAL);
+        inline explicit wordRe(const std::string&, const compOption = LITERAL);
 
         //- Construct from Istream
         //  Words are treated as literals, strings with an auto-test
diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
index 43110671654..01a3114c6c9 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -65,6 +65,18 @@ inline Foam::wordRe::wordRe(const word& str)
 {}
 
 
+inline Foam::wordRe::wordRe(const keyType& str)
+:
+    word(str, false),
+    re_()
+{
+    if (str.isPattern())
+    {
+        compile();
+    }
+}
+
+
 inline Foam::wordRe::wordRe(const keyType& str, const compOption opt)
 :
     word(str, false),
-- 
GitLab