https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69095

            Bug ID: 69095
           Summary: internal compiler error: in dependent_type_p, at
                    cp/pt.c:19399
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrmohitgarg1990 at gmail dot com
  Target Milestone: ---

Created attachment 37195
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37195&action=edit
Getting the size of Argument pack in Variadic Template

Hi,

The code below is creating a bug though it is not a correct code. 
  size_t Num=sizeof(Args)
This statement above is creating the bug as the Args is not expanded.

The error message which i am getting is this:
cpp_bug.cpp:7:63: internal compiler error: in dependent_type_p, at
cp/pt.c:19399
Please submit a full bug report

Pre-processed source is also attached.


----code starts here-----
#include <string>
#include <iostream>

struct Interface{
        template<typename Ret,typename... Args,size_t Num=sizeof(Args)>
        void insert(std::string s1, Ret(*f1)(Args... args) ){
                std::cout<<Num<<"\n";   
        }
};

int fun2(int a){
        std::cout<<"inside fun3\n";
        return a;
}

int fun3(int a,int b){
        std::cout<<"inside fun3\n";
        return a;
}

int main(){
        Interface a1;
        // a1.insert("fun1",fun1);
        a1.insert("fun2",fun2);
        a1.insert("fun3",fun3);

        return 0;
}

----code ends here-----

Environment:
Linux version 3.10-0.bpo.tmw5-amd64
(gcc version 4.7.2 (Debian 4.7.2-5) )

How-To-Repeat:
gcc --std=c++11 cpp_bug.cpp

Reply via email to