<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Parsing error in constructor with reference to variadic parameter"
   href="https://bugs.llvm.org/show_bug.cgi?id=32058">32058</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Parsing error in constructor with reference to variadic parameter
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>benni.buch@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18024" name="attach_18024" title="executen script">attachment 18024</a> <a href="attachment.cgi?id=18024&action=edit" title="executen script">[details]</a></span>
executen script

template < typename T, typename ... U >
struct first_of{
    using type = T;
};

template < typename T, typename ... U >
using first_of_t = typename first_of< T, U ... >::type;

struct A{
    template < typename ... T >
    A(first_of_t< int, T >& ... v){}
};

// same with
// template < typename ... T >
// struct A{
//     A(first_of_t< int, T >& ... v){}
// };


$ clang++ -std=c++11 -v -o main clang_fail.cpp 
clang version 4.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
a6d55d97a5aab126f77dc62fb215b9085da0ae7f) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
8de5c2160ffb77667e78349bd66f379cc70240ea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bebuch/media/programme/llvm-4/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/home/bebuch/media/programme/llvm-4/bin/clang-5.0" -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
clang_fail.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb
-resource-dir /home/bebuch/media/programme/llvm-4/bin/../lib/clang/4.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/bebuch/media/programme/llvm-4/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/bebuch/media/projekte/test -ferror-limit 19 -fmessage-length 271
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/clang_fail-0ce6bf.o -x c++ clang_fail.cpp
clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory
"/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0

/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
 /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0/backward
 /usr/local/include
 /home/bebuch/media/programme/llvm-4/bin/../lib/clang/4.0.0/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
clang-5.0:
/home/bebuch/media/projekte/llvm/llvm/include/llvm/Support/Casting.h:236:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::ReferenceType; Y = const clang::Type; typename llvm::cast_retty<X,
Y*>::ret_type = const clang::ReferenceType*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
#0 0x0000000001e2c0e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x1e2c0e8)
#1 0x0000000001e29cfe llvm::sys::RunSignalHandlers()
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x1e29cfe)
#2 0x0000000001e29e72 SignalHandler(int)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x1e29e72)
#3 0x00007f811278a390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f81114f6428 gsignal
/build/glibc-t3gR2i/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f81114f802a abort /build/glibc-t3gR2i/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f81114eebd7 __assert_fail_base
/build/glibc-t3gR2i/glibc-2.23/assert/assert.c:92:0
#7 0x00007f81114eec82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x00000000020b062a clang::ReferenceType const*
clang::Type::getAs<clang::ReferenceType>() const
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x20b062a)
#9 0x0000000002cf9bd2 clang::Sema::CheckFunctionDeclaration(clang::Scope*,
clang::FunctionDecl*, clang::LookupResult&,
bool)::{lambda(clang::QualType)#1}::operator()(clang::QualType) const
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2cf9bd2)
#10 0x0000000002d1a9b1 clang::Sema::CheckFunctionDeclaration(clang::Scope*,
clang::FunctionDecl*, clang::LookupResult&, bool)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2d1a9b1)
#11 0x0000000002d24ce4 clang::Sema::ActOnFunctionDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
bool&) (/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2d24ce4)
#12 0x0000000002d26e23 clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2d26e23)
#13 0x0000000002d9a9cc clang::Sema::ActOnCXXMemberDeclarator(clang::Scope*,
clang::AccessSpecifier, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Expr*,
clang::VirtSpecifiers const&, clang::InClassInitStyle)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2d9a9cc)
#14 0x0000000002a53219
clang::Parser::ParseCXXInlineMethodDef(clang::AccessSpecifier,
clang::AttributeList*, clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::VirtSpecifiers const&,
clang::SourceLocation)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a53219)
#15 0x0000000002a7f97a
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a7f97a)
#16 0x0000000002adae3b
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2adae3b)
#17 0x0000000002adbb4d
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2adbb4d)
#18 0x0000000002adbd51
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2adbd51)
#19 0x0000000002a7e863
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a7e863)
#20 0x0000000002a803d4
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType,
clang::Decl*) (/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a803d4)
#21 0x0000000002a82700
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a82700)
#22 0x0000000002a83731
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a83731)
#23 0x0000000002a641d7
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a641d7)
#24 0x0000000002a491e6
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a491e6)
#25 0x0000000002a499d1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.166] [clone
.constprop.191] (/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a499d1)
#26 0x0000000002a49a2f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a49a2f)
#27 0x0000000002a4b8ff
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a4b8ff)
#28 0x0000000002a4f572
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a4f572)
#29 0x0000000002a4497b clang::ParseAST(clang::Sema&, bool, bool)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x2a4497b)
#30 0x000000000265c039 clang::CodeGenAction::ExecuteAction()
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x265c039)
#31 0x000000000232cab6 clang::FrontendAction::Execute()
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x232cab6)
#32 0x00000000022feb96
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x22feb96)
#33 0x00000000023b56ca
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x23b56ca)
#34 0x0000000000a4ccd8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0xa4ccd8)
#35 0x00000000009df4c9 main
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0x9df4c9)
#36 0x00007f81114e1830 __libc_start_main
/build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:325:0
#37 0x0000000000a49589 _start
(/home/bebuch/media/programme/llvm-4/bin/clang-5.0+0xa49589)
Stack dump:
0.      Program arguments: /home/bebuch/media/programme/llvm-4/bin/clang-5.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name clang_fail.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/bebuch/media/programme/llvm-4/bin/../lib/clang/4.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/bebuch/media/programme/llvm-4/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/bebuch/media/projekte/test -ferror-limit 19 -fmessage-length 271
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/clang_fail-0ce6bf.o -x c++ clang_fail.cpp 
1.      clang_fail.cpp:12:32: current parser token '{'
2.      clang_fail.cpp:10:1: parsing struct/union/class body 'A'
clang-5.0: error: unable to execute command: Aborted
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
a6d55d97a5aab126f77dc62fb215b9085da0ae7f) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
8de5c2160ffb77667e78349bd66f379cc70240ea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bebuch/media/programme/llvm-4/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-5.0: note: diagnostic msg: /tmp/clang_fail-1085af.cpp
clang-5.0: note: diagnostic msg: /tmp/clang_fail-1085af.sh
clang-5.0: note: diagnostic msg: 

********************</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>