あっても(なくても)いいtypename

  • The keyword typename shall only be applied to qualified names, but those names need not be dependent. (14.6/5)
  • 上の文は、最新のDraftでは(typenameのルールを緩くするため?)削除されているようだ

[]struct[] []X[]
[]{[]
[]typedef[] []int[] []type[][];[]
[]};[]

[]template[][]< [][]class[] []T[][] >[]
[]typename[] []X[][]::[][]type[]
[]foo[][]([][]typename[] []X[][]::[][]type[] []a[][])[]
[]{[]
[]typename[] []X[][]::[][]type[] []b[][] = [][]0[][];[]
[]return[] []b[][];[]
[]}[]

[]template[][]< [][]class[] []T[][] >[]
[]X[][]::[][]type[]
[]bar[][]([][]X[][]::[][]type[] []a[][])[]
[]{[]
[]X[][]::[][]type[] []b[][] = [][]0[][];[]
[]return[] []b[][];[]
[]}[]

[]int[] []main[][]()[]
[]{[]
[] ::[][]foo[][]<[][]double[][]>([][]1[][]);[]
[] ::[][]bar[][]<[][]double[][]>([][]1[][]);[]
[]}[]