{"action":"created","issue":{"url":"https://api.github.com/repos/compuphase/pawn/issues/20","repository_url":"https://api.github.com/repos/compuphase/pawn","labels_url":"https://api.github.com/repos/compuphase/pawn/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/compuphase/pawn/issues/20/comments","events_url":"https://api.github.com/repos/compuphase/pawn/issues/20/events","html_url":"https://github.com/compuphase/pawn/issues/20","id":167446092,"number":20,"title":"tagof(<tag name>:) in a switch statement bug","user":{"login":"Daniel-Cortez","id":5159716,"avatar_url":"https://avatars.githubusercontent.com/u/5159716?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel-Cortez","html_url":"https://github.com/Daniel-Cortez","followers_url":"https://api.github.com/users/Daniel-Cortez/followers","following_url":"https://api.github.com/users/Daniel-Cortez/following{/other_user}","gists_url":"https://api.github.com/users/Daniel-Cortez/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel-Cortez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel-Cortez/subscriptions","organizations_url":"https://api.github.com/users/Daniel-Cortez/orgs","repos_url":"https://api.github.com/users/Daniel-Cortez/repos","events_url":"https://api.github.com/users/Daniel-Cortez/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel-Cortez/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/compuphase/pawn/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"compuphase","id":11457347,"avatar_url":"https://avatars.githubusercontent.com/u/11457347?v=3","gravatar_id":"","url":"https://api.github.com/users/compuphase","html_url":"https://github.com/compuphase","followers_url":"https://api.github.com/users/compuphase/followers","following_url":"https://api.github.com/users/compuphase/following{/other_user}","gists_url":"https://api.github.com/users/compuphase/gists{/gist_id}","starred_url":"https://api.github.com/users/compuphase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/compuphase/subscriptions","organizations_url":"https://api.github.com/users/compuphase/orgs","repos_url":"https://api.github.com/users/compuphase/repos","events_url":"https://api.github.com/users/compuphase/events{/privacy}","received_events_url":"https://api.github.com/users/compuphase/received_events","type":"User","site_admin":false},"assignees":[{"login":"compuphase","id":11457347,"avatar_url":"https://avatars.githubusercontent.com/u/11457347?v=3","gravatar_id":"","url":"https://api.github.com/users/compuphase","html_url":"https://github.com/compuphase","followers_url":"https://api.github.com/users/compuphase/followers","following_url":"https://api.github.com/users/compuphase/following{/other_user}","gists_url":"https://api.github.com/users/compuphase/gists{/gist_id}","starred_url":"https://api.github.com/users/compuphase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/compuphase/subscriptions","organizations_url":"https://api.github.com/users/compuphase/orgs","repos_url":"https://api.github.com/users/compuphase/repos","events_url":"https://api.github.com/users/compuphase/events{/privacy}","received_events_url":"https://api.github.com/users/compuphase/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-07-25T19:29:23Z","updated_at":"2016-08-01T15:44:55Z","closed_at":"2016-08-01T15:44:55Z","body":"This bug was originally discovered by @ziggi.\r\n```Pawn\r\n#include <console>\r\n#include <float>\r\n\r\nstock PrintInt(i)\r\n\tprintf(\"int: %d\\n\", i);\r\n\r\nstock PrintFloat(Float:f)\r\n\tprintf(\"float: %f\\n\", f);\r\n\r\nstock PrintBool(bool:b)\r\n\tprintf(\"bool: %s\\n\", (b)?(\"true\"):(\"false\"));\r\n\r\nstock Print({_, Float, bool}:arg, arg_tag=tagof(arg))\r\n{\r\n\tswitch(arg_tag)\r\n\t{\r\n\t\tcase tagof(Float:):\t\t\t\t// Line 17\r\n\t\t\tPrintFloat(Float:arg);\r\n\t\tcase tagof(bool:):\r\n\t\t\tPrintBool(bool:arg);\r\n\t\tdefault:\r\n\t\t\tPrintInt(_:arg);\r\n\t}\r\n}\r\n\r\nmain()\r\n{\r\n\tprint(\"--Function overloading emulation test--\\n\");\r\n\tPrint(1);\r\n\tPrint(1.0);\r\n\tPrint(true);\r\n}\r\n```\r\nWhen I try to compile this the compiler shows a bunch of error messages:\r\n```\r\ntest.p(17) : error 081: expression with tag override must appear between parentheses\r\ntest.p(17) : error 029: invalid expression, assumed zero\r\ntest.p(19) : warning 217: loose indentation\r\ntest.p(19) : error 014: invalid statement; not in switch\r\ntest.p(19) : warning 215: expression has no effect\r\ntest.p(19) : error 001: expected token: \";\", but found \":\"\r\ntest.p(19) : error 029: invalid expression, assumed zero\r\ntest.p(19) : fatal error 107: too many error messages on one line\r\n6 Errors.\r\nCompilation aborted.\r\n```\r\nBut if I put the tagof expressions into parentheses...\r\n```Pawn\r\n\t\tcase (tagof(Float:)):\t\t\t\t// Line 17\r\n\t\t\tPrintFloat(Float:arg);\r\n\t\tcase (tagof(bool:)):\r\n\t\t\tPrintBool(bool:arg);\r\n```\r\n... the code compiles and works normally."},"comment":{"url":"https://api.github.com/repos/compuphase/pawn/issues/comments/236619759","html_url":"https://github.com/compuphase/pawn/issues/20#issuecomment-236619759","issue_url":"https://api.github.com/repos/compuphase/pawn/issues/20","id":236619759,"user":{"login":"compuphase","id":11457347,"avatar_url":"https://avatars.githubusercontent.com/u/11457347?v=3","gravatar_id":"","url":"https://api.github.com/users/compuphase","html_url":"https://github.com/compuphase","followers_url":"https://api.github.com/users/compuphase/followers","following_url":"https://api.github.com/users/compuphase/following{/other_user}","gists_url":"https://api.github.com/users/compuphase/gists{/gist_id}","starred_url":"https://api.github.com/users/compuphase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/compuphase/subscriptions","organizations_url":"https://api.github.com/users/compuphase/orgs","repos_url":"https://api.github.com/users/compuphase/repos","events_url":"https://api.github.com/users/compuphase/events{/privacy}","received_events_url":"https://api.github.com/users/compuphase/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T15:44:54Z","updated_at":"2016-08-01T15:44:54Z","body":"Fixed in commit https://github.com/compuphase/pawn/commit/a25041aef511fea6ff1a6930949e5c05f77bac74"}}
{"actor":{"display_login":"compuphase"}}