Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-15141

Text editor crash in code model: self-referring template causes infinite recursion.

    XMLWordPrintable

Details

    Description

      Text editor crashes on code:

      
      template <class R1, class R2>
      struct ratio_multiply
      : boost::ratio_detail::ratio_multiply<R1, R2>::type
      {
      };
      
      template<typename R, int p>
      struct ratio_power :
        ratio_multiply<
          typename ratio_power<R, p%2>::type,
          typename ratio_power<typename ratio_multiply<R, R>::type, p/2>::type
        >::type
      {};
      

      or slightly simpler example:

      template <class R1>
      struct ratio_multiply
      {
      };
      
      template<typename R, int p>
      struct ratio_power :
        ratio_multiply<
          typename ratio_power<typename ratio_multiply<R>::type, p>::type,
          typename ratio_power<typename ratio_multiply<R>::type, p>::type
        >::type
      {};
      

      Attachments

        1. qtc-crash.zip
          0.7 kB
        2. test2.cpp
          13 kB
        3. test3.cpp
          509 kB
        4. stack_overflow.txt
          81 kB
        5. test4.cpp
          5 kB
        6. stack_overflow_2.txt
          10 kB

        Issue Links

          Activity

            People

              orgads Orgad Shaneh
              mapron Smirnov Vladimir
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: