c++ - Constructor-style casting in function call parameters -


I do not understand that using the constructor-style casting fails to compile the following code:

  template & lt; Typename T & gt; Zero Efu (Constant T & T) {} Int Main () {EF (Unsigned Four (0)); }   

Errors are:

  • Error: the expected expression of expression should already be ????
  • Although these three syntax are correct

  • error: expected '(' function-style cast or type

      templates for building  T   

    Then this kind of place is clearly to blame here.

    I thought Was it possible to relate to our old friend in some way, so I tried, which should get rid of this type of ambiguity, but no luck:

      template   

    but still: < ul>

  • ERROR: Expected prefix for the GCC "without signing" .
  • Error: Expected '(function-style cast or page)

    So my question is why is not that function, allowing one type home in style caps? It does not seem unclear to me.

    Note : I know that I foo & lt; Unsigned char & gt; (0) , but does not answer this question;)

    < Code> [C ++ 11: 5.2.3 / 1]: A Simple-type-specifier (7.1.6.2) or typename-specifier (14.6 ) After that, the parenthesized expression-list creates a value of the specified type according to the expression list. [..]

    Checking grammar, we see that unsigned char from simple-typed-specialifier Production happens by uniting two of them.

    As evidence of the rumor loss, Table 10 is telling the opposite, which I can start myself a while ago (: P) The table title is called "Specification (Optional)" (optional Note the plural), and refer to the route given below:

    [C ++ 11: 5.2.3 / 2]: [. .] summarize simple-type-specifiers and the type of valid combination specified by them in Table 10 is. (emphasis my)

    Now, in some cases the permission of the combination of simple-type-specifiers Is:

    [C ++ 11: 7.1.6.2/3]: When multiple simple-type-specifiers are allowed, They may be intermixed freely with other announcement-specifiers in any order [..]

    . .. but there is no indication that it is in the case of functional notation, which clearly Area " a simple-type-specifier " - singular.

    That's why GCC is correct, and the visual studio is wrong.

    Why this is the case ... well, I do not know. I suspect that we can come in some vague edge case, but there is a good thing in the comments given below so that this function is incompatible with call syntax, because the name of the function can not contain empty spaces.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -