http://llvm.org/bugs/show_bug.cgi?id=21755

            Bug ID: 21755
           Summary: In-class initialization with template function call
                    fails to compile
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

template<typename T, typename U> int f()
{ 
  return 42;
}
struct C
{ 
  int v=f<int,int>();
};
int main() { return 0; }

This fails to compile:

$ clang -std=c++11 inclass_init_template.cpp 
inclass_init_template.cpp:8:15: error: expected member name or ';' after
      declaration specifiers
  int v=f<int,int>();
  ~~~         ^
inclass_init_template.cpp:8:15: error: expected ';' at end of declaration list
  int v=f<int,int>();
              ^
              ;
inclass_init_template.cpp:8:14: error: expected '>'
  int v=f<int,int>();
             ^
3 errors generated.

It compiles
- if there is one template parameter,
- or if the initialization is placed in the initializer list of a constructor
- or if the same declaration is used to declare a local variable
- or if the function is made to have parameters and its template arguments are
deduced from the parameters,
- or if GCC 4.8.3 is used instead of clang.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to