Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-345

[Sun C++ 5.8] bogus error on a member function of local struct in a template

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • External
    • None
    • Sun C++ 5.8

    Description

      -------- Original Message --------
      Subject: Your Report (Review ID: 920283) - Sun C++ 5.8 bogus error on a member function of local struct in a template
      Date: Fri, 2 Mar 2007 15:35:20 -0700 (MST)
      From: IncidentDaemon@sun.com <IncidentDaemon@sun.com>
      To: sebor@roguewave.com

      Dear Sun Studio Developer,

      Thank you for your interest in improving the quality of Sun Studio
      product.

      Your report has been assigned an internal review ID of 920283.

      Please be aware that the large volume of reports we receive sometimes
      prevents us from responding individually to each message.

      If the information is determined to be a new Bug or Request for
      Enhancement (RFE), or a duplicate of a known Bug or RFE, you will
      receive a followup email containing a seven digit bug number. By
      using this seven digit bug number, you may search for, view, or vote
      for this bug in the Bug Database at http://bugs.sun.com/. Please note
      that we cannot promise to fix all reported bugs.

      If you just reported an issue that could have a major impact on your
      project and require a timely response, please consider purchasing
      one of the support offerings described at
      http://developers.sun.com/prodtech/cc/support/support_services.jsp.

      The Sun Developer Network (http://developers.sun.com) is a free service
      that Sun offers. To join, visit http://developers.sun.com/global/join_sdn.html.

      Regards,
      Sun Studio Developer Bug Report Review Team

      ---------------------------------------------------------------

      Date Created: Fri Mar 02 15:35:18 MST 2007
      Type: bug
      Customer Name: Martin Sebor
      Customer Email: sebor@roguewave.com
      SDN ID:
      status: Waiting
      Category: c++
      Subcategory: other
      Company: Rogue Wave Software
      release: studio11
      hardware: sun4
      OSversion: solaris_10
      priority: 4
      Synopsis: Sun C++ 5.8 bogus error on a member function of local struct in a template
      Description:
      FULL PRODUCT VERSION :
      N/A

      ADDITIONAL OS VERSION INFORMATION :
      Solaris 10

      A DESCRIPTION OF THE PROBLEM :
      The attached well-formed program fails to compile with Sun C++ 5.8.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      $ cat t.cpp && CC -V t.cpp
      template <class T> struct A { };

      template <class T>
      void foo () {
      struct { A<T> bar () const

      { return A<T>(); } } x;
      x.bar ();
      }

      int main ()
      {
      foo<int>();
      }

      CC: Sun C++ 5.8 Patch 121017-08 2006/12/06
      ccfe: Sun C++ 5.8 Patch 121017-08 2006/12/06
      "t.cpp", line 5: Error: T is not defined.
      "t.cpp", line 11: Where: While instantiating "foo<int>()".
      "t.cpp", line 11: Where: Instantiated from non-template code.
      "t.cpp", line 5: Error: Cannot use int to initialize A<int>.
      "t.cpp", line 11: Where: While instantiating "foo<int>()".
      "t.cpp", line 11: Where: Instantiated from non-template code.
      2 Error(s) detected.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No errors.
      ACTUAL -
      Compilation errors.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      "t.cpp", line 5: Error: T is not defined.
      "t.cpp", line 11: Where: While instantiating "foo<int>()".
      "t.cpp", line 11: Where: Instantiated from non-template code.
      "t.cpp", line 5: Error: Cannot use int to initialize A<int>.
      "t.cpp", line 11: Where: While instantiating "foo<int>()".
      "t.cpp", line 11: Where: Instantiated from non-template code.
      2 Error(s) detected.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      template <class T> struct A { };

      template <class T>
      void foo () {
      struct { A<T> bar () const { return A<T>(); }

      } x;
      x.bar ();
      }

      int main ()
      {
      foo<int>();
      }

      ---------- END SOURCE ----------
      workaround:
      comments: (company - Rogue Wave Software , email - sebor@roguewave.com)

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebor Martin Sebor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: