[llvm-bugs] [Bug 38282] New: expected ';' after expression

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 23 19:00:56 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38282

            Bug ID: 38282
           Summary: expected ';' after expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

My command line is clang++ -std=c++17 code0.cpp

The code is as follow:

template<typename... Args>
void spurious(Args... args)
{
    (... + args).member;
}

int main()
{
}

The error message is:

code0.cpp:4:14: error: expected ';' after expression
 (... + args).member;
             ^
             ;
code0.cpp:4:14: error: expected expression
2 errors generated.

Another similar code sample is as follow:

template <typename... Args>
int
foo (Args... args)
{
 return (... + args).member;
}

struct S { int member; } s = { 0 };

int
main ()
{
 return foo (s);
}

Again, clang++ rejects it, but g++ accept it.

Are the above two code samples legal code?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180724/2f8a118e/attachment.html>


More information about the llvm-bugs mailing list