Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 7774
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Nathan Sidwell <nathan@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: jajarvi@cs.indiana.edu
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 7774 depends on: Show dependency tree
Show dependency graph
Bug 7774 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-08-30 08:46
Suppose a primary template 

  template <class T> class A;

and a sepcialization:

  template <class T> class A<volatile T>;

When instantiated with a plain function type (that is, not a pointer or
reference to function), the compiler picks the specialization for volatile.
(It gives warnings that volatile qualifiers are ignored).

Release:
3.2

Environment:
System: SunOS ford.osl.iu.edu 5.8 Generic_108528-15 sun4u sparc SUNW,Sun-Blade-100
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../dist/configure --prefix=/l/gcc320 --enable-language=c,c++,f77,java

How-To-Repeat:
This program demonstrates the error:

#include <iostream>

template <class T> class A { 
public:
  static void foo () { std::cout << "Not volatile"; }
};

template <class T> class A<volatile T> {
public:
  static void foo () { std::cout << "Volatile"; }
};

template <class T>
void x(T& t) {
  A<T>::foo();
  // T here should be a plain function type int()() (not a pointer, not a ref)

  // The compiler (3.20) picks the specializatoin for A<volatile T> ???
}

int bar() {};

int main() {
  x(bar);
};

// -----------------------

This the output from the compiler:

/l/gcc320/bin/g++ -I/u/jajarvi/boost testi.cpp
testi.cpp: In instantiation of `A<int ()()>':
testi.cpp:15:   instantiated from `void x(T&) [with T = int ()()]'
testi.cpp:24:   instantiated from here
testi.cpp:8: warning: ignoring `volatile' qualifiers on `int ()()'
testi.cpp:8: warning: ignoring `volatile' qualifiers on `int ()()'

And when the program is run, it outputs "Volatile".

------- Comment #1 From Wolfgang Bangerth 2002-11-21 18:51 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: This used to work with 2.95, so I mark it as a regression.
    
    However, note that it is fixed in 3.3CVS already.

------- Comment #2 From Kriang Lerdsuwanakij 2002-12-03 06:40 -------
Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-Why: Will look at it.  Appear to be related to PR 8503.

------- Comment #3 From Kriang Lerdsuwanakij 2002-12-05 06:27 -------
Responsible-Changed-From-To: lerdsuwa->nathan
Responsible-Changed-Why: Same problem as PR8503.

------- Comment #4 From Nathan Sidwell 2002-12-26 04:57 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: 2002-12-26  Nathan Sidwell  <nathan@codesourcery.com>
    
    	PR c++/8503
    	Remove DR 295 implementation.
    	* pt.c (check_cv_quals_for_unify): Disable function & method cases.
    	* tree.c (cp_build_qualified_type_real): Likewise. Don't warn
    	about ignoring volatile qualifiers.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug