aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/parser.cxx11
-rw-r--r--tests/variable/type-pattern/buildfile6
2 files changed, 14 insertions, 3 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 526a905..689db66 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -522,11 +522,16 @@ namespace build2
if (!n.dir.empty ())
sg = enter_scope (*this, move (n.dir));
- // Resolve target type. If none is specified, use the root
- // of the hierarchy.
+ // Resolve target type. If none is specified or if it is
+ // '*', use the root of the hierarchy. So these are all
+ // equivalent:
+ //
+ // *: foo = bar
+ // {*}: foo = bar
+ // *{*}: foo = bar
//
const target_type* ti (
- n.untyped ()
+ n.untyped () || n.type == "*"
? &target::static_type
: scope_->find_target_type (n.type));
diff --git a/tests/variable/type-pattern/buildfile b/tests/variable/type-pattern/buildfile
index 8c353a5..dd218ac 100644
--- a/tests/variable/type-pattern/buildfile
+++ b/tests/variable/type-pattern/buildfile
@@ -30,4 +30,10 @@ file{fox-x-fox}: x = $x # still '2'!
*-foz: x = z # any target
file{x-foz}: x = $x # 'z'
+# These should all be the same.
+#
+*: x1 = X1
+{*}: x2 = X2
+*{*}: x3 = X3
+
./: