Skip to content
Browse files

Issue 6873 - Multiple storage class is not allowed on template argument

  • Loading branch information...
1 parent 77a6173 commit 3f0ccbaa3daa47a0b4a18b1ae2d55871e5e41a1e @9rnsr 9rnsr committed
Showing with 27 additions and 12 deletions.
  1. +17 −12 src/parse.c
  2. +10 −0 test/runnable/xtest46.d
View
29 src/parse.c
@@ -4498,18 +4498,23 @@ int Parser::isDeclaration(Token *t, int needId, enum TOK endtok, Token **pt)
int haveId = 0;
#if DMDV2
- if ((t->value == TOKconst ||
- t->value == TOKinvariant ||
- t->value == TOKimmutable ||
- t->value == TOKwild ||
- t->value == TOKshared) &&
- peek(t)->value != TOKlparen)
- { /* const type
- * immutable type
- * shared type
- * wild type
- */
- t = peek(t);
+ while (1)
+ {
+ if ((t->value == TOKconst ||
+ t->value == TOKinvariant ||
+ t->value == TOKimmutable ||
+ t->value == TOKwild ||
+ t->value == TOKshared) &&
+ peek(t)->value != TOKlparen)
+ { /* const type
+ * immutable type
+ * shared type
+ * wild type
+ */
+ t = peek(t);
+ continue;
+ }
+ break;
}
#endif
View
10 test/runnable/xtest46.d
@@ -4663,6 +4663,16 @@ void test3091(inout int = 0)
}
/***************************************************/
+// 6837
+
+template Id6837(T)
+{
+ alias T Id6837;
+}
+static assert(is(Id6837!(shared const int) == shared const int));
+static assert(is(Id6837!(shared inout int) == shared inout int));
+
+/***************************************************/
// 6056 fixup
template ParameterTypeTuple6056(func)

0 comments on commit 3f0ccba

Please sign in to comment.
Something went wrong with that request. Please try again.